Files
Yi.Admin/CC.Yi/CC.Yi.IBLL/IBaseBll.cs

83 lines
2.0 KiB
C#
Raw Normal View History

2021-05-13 01:39:34 +08:00
using Autofac.Extras.DynamicProxy;
using System;
2021-03-20 14:12:24 +08:00
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
2021-06-02 20:00:25 +08:00
using System.Threading.Tasks;
2021-03-20 14:12:24 +08:00
namespace CC.Yi.IBLL
{
public interface IBaseBll<T> where T : class, new()
{
2021-06-02 20:00:25 +08:00
#region
//通过id得到实体
#endregion
Task<T> GetEntityById(int id);
2021-03-20 15:02:23 +08:00
#region
//得到全部实体
#endregion
IQueryable<T> GetAllEntities();
2021-05-13 01:39:34 +08:00
2021-03-20 15:02:23 +08:00
#region
//通过表达式得到实体
#endregion
2021-03-20 14:12:24 +08:00
IQueryable<T> GetEntities(Expression<Func<T, bool>> whereLambda);
2021-03-20 15:02:23 +08:00
#region
//通过表达式得到实体,分页版本
#endregion
IQueryable<T> GetPageEntities<S>(int pageSize, int pageIndex, out int total, Expression<Func<T, bool>> whereLambda, Expression<Func<T, S>> orderByLambda, bool isAsc);
#region
//通过表达式统计数量
#endregion
int GetCount(Expression<Func<T, bool>> whereLambda);
2021-03-20 14:12:24 +08:00
#region
2021-03-20 15:02:23 +08:00
//通过表达式分组
2021-03-20 14:12:24 +08:00
#endregion
IQueryable<IGrouping<S, T>> GetGroup<S>(Expression<Func<T, bool>> whereLambda, Expression<Func<T, S>> groupByLambda);
2021-03-20 15:02:23 +08:00
#region
//添加实体
#endregion
2021-03-20 14:12:24 +08:00
T Add(T entity);
2021-05-13 01:39:34 +08:00
#region
//添加多个实体
#endregion
bool Add(IEnumerable<T> entities);
2021-03-20 15:02:23 +08:00
#region
//更新实体
#endregion
2021-03-20 14:12:24 +08:00
bool Update(T entity);
2021-05-13 01:39:34 +08:00
#region
//更新实体部分属性
#endregion
bool Update(T entity, params string[] propertyNames);
2021-03-20 15:02:23 +08:00
#region
//删除实体
#endregion
2021-03-20 14:12:24 +08:00
bool Delete(T entity);
2021-03-20 15:02:23 +08:00
#region
//通过id删除实体
#endregion
2021-03-20 14:12:24 +08:00
bool Delete(int id);
2021-03-20 15:02:23 +08:00
#region
//通过id列表删除多个实体
#endregion
2021-05-13 01:39:34 +08:00
bool Delete(IEnumerable<int> ids);
#region
//通过表达式删除实体
#endregion
bool Delete(Expression<Func<T, bool>> where);
2021-03-20 14:12:24 +08:00
}
}