Reputation: 219
Hello stackoverflow i am having trouble with a LINQ query.
from ri in App.db.RecipeIngredients
join i in App.db.Ingredients on ri.IngredientID equals i.ID
join r in App.db.Recipes on ri.RecipeID equals r.ID
where recipeIDs.Any(rid => rid == ri.RecipeID)
group new Result()
{
recipe = ri.Recipe,
ingredient = ri.Ingredient,
quantity = ri.Quantity
} by ri.RecipeID
This is the code that i have made so far, the recipeIDs is a list of ints. but when the recipeIDs list exceeds 30 ints the program breaks with the error "Too high level of nesting for select", i have been googleing, but at this point i have no idea how to fix it. can some of you help me?
Upvotes: 3
Views: 2263
Reputation: 219
I have fixed the problem by my self, the fix was in the where, i replaced it with:
where recipeIDs.Contains(ri.RecipeID)
Upvotes: 10