Пример #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();
            }
        }