不成功的MVC Repository模式,记录下来,后面看看原因在哪里(一) IRepository类

 1  public interface IRepository<T> where T:class
 2     {
 3         //增加
 4         T Add(T entity);
 5         //更新
 6         bool Update(T entity);
 7         //删除
 8         bool Delete(T entity);
 9         //检查名字是否为空
10         bool CheckNameIsEmpty(Expression<Func<T, bool>> whereLambda);
11         //检查名字是否存在
12         bool CheckNameExist(Expression<Func<T, bool>> whereLambda);
13         //判断其他输入项是否都符合要求
14         bool Check(Expression<Func<T, bool>> whereLambda);
15         //保存
16         //void Save();
17         //统计
18         int Count(Expression<Func<T, bool>> predicate);
19         //强制类型转换列表
20         List<T> ToList();
21         //查找
22         T Find(Expression<Func<T, bool>> whereLambda);
23         //条件查找
24         IQueryable<T> FindList(Expression<Func<T, bool>> whereLamba, string orderName, bool isAsc);
25         //条件查找
26         IQueryable<T> FindList<S>(Expression<Func<T, bool>> whereLambda, bool isAsc,
27             Expression<Func<T, S>> orderLamba);
28         //条件查找
29 
30         IQueryable<T> FindPageList<S>(int pageIndex, int pageSize, out int totalRecordCnt,
31             Expression<Func<T, bool>> whereLamdba, bool isAsc, Expression<Func<T, S>> orderLambda);
32 
33     }

 

posted @ 2014-10-22 17:11  smallbird2012  阅读(664)  评论(0编辑  收藏  举报