public void Delete(T entity) { using (var dataContext = new AntContext()) { dataContext.Set <T>().Remove(entity); dataContext.SaveChanges(); } }
public void Add(T entity) { using (var dataContext = new AntContext()) { dataContext.Set <T>().Add(entity); dataContext.SaveChanges(); } }
public IQueryable <T> Find(Expression <Func <T, bool> > predicate) { using (var dataContext = new AntContext()) { IQueryable <T> query = dataContext.Set <T>().Where(predicate); return(query); } }
public IQueryable <T> GetAll() { using (var dataContext = new AntContext()) { IQueryable <T> query = dataContext.Set <T>(); return(query); } }
public Repository(AntContext context) { Db = context; DbSet = Db.Set <TEntity>(); }