public List <T> FindByProc(string SQL, params SqlParameter[] parameters)
 {
     using (var context = new KindeeDBContext())
     {
         return(context.Database.SqlQuery <T>(SQL, parameters).ToList());
     }
 }
 /// <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));
     }
 }
 //KindeeDBContext Context = new KindeeDBContext();
 // protected KindeeDBContext Context = new KindeeDBContext();
 public int ExecuteSql(string sql)
 {
     using (var context = new KindeeDBContext())
     {
         return(context.Database.ExecuteSqlCommand(sql));
     }
 }
 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);
     }
 }
 public bool IsExist(System.Linq.Expressions.Expression <Func <T, bool> > exp)
 {
     using (var context = new KindeeDBContext()) {
         return(context.Set <T>().Any(exp));
     }
 }