Beispiel #1
0
 public void Delete(T entity)
 {
     using (var dataContext = new AntContext())
     {
         dataContext.Set <T>().Remove(entity);
         dataContext.SaveChanges();
     }
 }
Beispiel #2
0
 public void Add(T entity)
 {
     using (var dataContext = new AntContext())
     {
         dataContext.Set <T>().Add(entity);
         dataContext.SaveChanges();
     }
 }
Beispiel #3
0
        public IQueryable <T> Find(Expression <Func <T, bool> > predicate)
        {
            using (var dataContext = new AntContext())

            {
                IQueryable <T> query = dataContext.Set <T>().Where(predicate);
                return(query);
            }
        }
Beispiel #4
0
        public IQueryable <T> GetAll()
        {
            using (var dataContext = new AntContext())

            {
                IQueryable <T> query = dataContext.Set <T>();
                return(query);
            }
        }
Beispiel #5
0
 public Repository(AntContext context)
 {
     Db    = context;
     DbSet = Db.Set <TEntity>();
 }