public IEnumerable <T> GetAll(string[] includes = null) { //HANDLE INCLUDES FOR ASSOCIATED OBJECTS IF APPLICABLE if (includes != null && includes.Any()) { DbQuery <T> query = DataContext.Set <T>() .Include(includes.First()); foreach (string include in includes.Skip(1)) { query = query.Include(include); } return(query.AsQueryable()); } return(DataContext.Set <T>() .AsQueryable()); }
public int Count(Func <T, bool> predicate) { return(_context.Set <T>().Where(predicate).Count()); }