示例#1
0
        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());
        }
示例#2
0
 public int Count(Func <T, bool> predicate)
 {
     return(_context.Set <T>().Where(predicate).Count());
 }