예제 #1
0
 public static IQueryable <TEntity> GetAll()
 {
     using (var db = new DEAContext())
     {
         return(db.Set <TEntity>());
     }
 }
예제 #2
0
 public static IQueryable <TEntity> SearchFor(Expression <Func <TEntity, bool> > predicate)
 {
     using (var db = new DEAContext())
     {
         return(db.Set <TEntity>().Where(predicate));
     }
 }
예제 #3
0
 public static async Task DeleteAsync(TEntity entity)
 {
     using (var db = new DEAContext())
     {
         db.Set <TEntity>().Remove(entity);
         await db.SaveChangesAsync();
     }
 }
예제 #4
0
        public static async Task InsertAsync(TEntity entity)
        {
            using (var db = new DEAContext())
            {
                await db.Set <TEntity>().AddAsync(entity);

                await db.SaveChangesAsync();
            }
        }