Exemplo n.º 1
0
        public T GetSingleWithInclude <TProp>(int id, params Expression <Func <T, TProp> >[] exp)
        {
            var set = Context.Set <T>();
            IIncludableQueryable <T, TProp> resultSet = set.Include(exp[0]);

            for (int i = 1; i < exp.Length; i++)
            {
                set.Include(exp[i]);
            }
            ;

            return(resultSet.FirstOrDefault(e => e.Id == id));
        }
Exemplo n.º 2
0
        public Meal Find(int id)
        {
            IIncludableQueryable <Meal, FoodItem> wackyEntity = context.Meals.Include(x => x.MealFoodItems).ThenInclude(x => x.FoodItems);

            return(wackyEntity.FirstOrDefault(x => x.MealID == id));
        }