using System; using System.Linq; using System.Linq.Expressions; using YZXYH.Repository.Models; namespace YZXYH.Repository.Interface { public interface IBaseRepository { /// /// 是否存在 /// /// 过滤条件 /// bool IsExist(Expression> exp); /// /// 过滤排序查询 /// /// 过滤条件(eg: u=>u.Id="1") /// 排序(eg: q=>q.OrderByDescending(u=>u.Name)) /// 外键 /// 对象集合 IQueryable Get(Expression> exp = null, Func, IOrderedQueryable> orderBy = null, string includeProperties = ""); /// /// 分页排序记录 /// /// The pageindex. /// The pagesize. /// 排序(eg: q=>q.OrderByDescending(u=>u.Name)) /// 过滤条件(eg: u=>u.Id="1") /// 外键 IQueryable Get(int pageindex, int pagesize, Func, IOrderedQueryable> orderBy = null, Expression> exp = null, string includeProperties = ""); /// /// 查找单个 /// T GetSingle(Expression> exp); /// /// 根据Id获取数据 /// /// /// T GetById(string id); /// /// 根据过滤条件获取记录数 /// int GetCount(Expression> exp = null); /// /// 普通插入 /// /// void Insert(T t); /// /// 没有主键Id的插入 /// /// void InsertNoId(T t); /// /// 批量插入 /// /// The entities. void BatchInsert(T[] ts); /// /// 删除记录 /// /// void Delete(T t); /// /// 删除记录 /// /// 过滤条件 void Delete(Expression> exp); /// ///根据Id删除 /// /// void DeleteById(string id); /// /// 更新 /// /// void Update(T t); /// /// 实现按需要只更新部分更新 /// 如:Update(u =>u.Id==1,u =>new User{Name="ok"}); /// /// The where. /// The entity. void Update(Expression> where, Expression> t); /// /// 按指定id更新实体,会更新整个实体 /// /// The identity exp. /// The entity. void Update(Expression> identityExp, T t); /// /// 查询记录条数(Chat.js) /// /// 参数 “表名 | 条件语句 , 表名 | 条件语句” /// (多个查询以 , 分隔,表名与条件语句以 | 分隔) /// string[] GetCounts(string[] queryStrs); bool Save(); } }