示例#1
0
 /// <summary>
 /// 查找单个
 /// </summary>
 public T FindSingle(System.Linq.Expressions.Expression <Func <T, bool> > exp)
 {
     using (var context = new KindeeDBContext())
     {
         return(context.Set <T>().AsNoTracking().FirstOrDefault(exp));
     }
 }
示例#2
0
 public IQueryable <T> Filter(System.Linq.Expressions.Expression <Func <T, bool> > exp)
 {
     using (var context = new KindeeDBContext()) {
         var dbSet = context.Set <T>().AsQueryable();
         if (exp != null)
         {
             dbSet = dbSet.Where(exp);
         }
         return(dbSet);
     }
 }
示例#3
0
 public bool IsExist(System.Linq.Expressions.Expression <Func <T, bool> > exp)
 {
     using (var context = new KindeeDBContext()) {
         return(context.Set <T>().Any(exp));
     }
 }