I'm using .net, mssql, LinqToSQL. My mssql db has the following schema - Recipes are related to Ingredients. Now I want to let users to find recipes by several ingredients. I need a stored-procedure or query which I can use to select all those recipes. The number of searching ingredients is unknown.
I tried to use lintosql
var list = datacontext.Recipes.Where(r => values.All(v => r.RecipeIngredientMeasures.Any(i => i.Ingredient.NameTrans == v))).ToList();
Where values is array of my searching ingredients.
But then I got
"Local sequence cannot be used in LINQ to SQL implementations of query operators except the Contains operator."