public IEnumerable <T> GetAll(string[] includes = null) { //HANDLE INCLUDES FOR ASSOCIATED OBJECTS IF APPLICABLE if (includes != null && includes.Count() > 0) { var query = dataContext.Set <T>().Include(includes.First()); foreach (var include in includes.Skip(1)) { query = query.Include(include); } return(query.AsQueryable()); } return(dataContext.Set <T>().AsQueryable()); }
public virtual TEntity Add(TEntity entity) { dbContext.Set <TEntity>().Add(entity); return(entity); }
public virtual bool CheckContains(Expression <Func <T, bool> > predicate) { return(dbContext.Set <T>().Count <T>(predicate) > 0); }
public Repository(OnlineShopDbContext context) { this.context = context; this.dbSet = context.Set <TEntity>(); }
protected RepositoryBase(OnlineShopDbContext onlineShopDbContext) { dataContext = onlineShopDbContext; dbSet = dataContext.Set <T>(); }