I want to return all the entities of a database where ALL child elements of a parent are found in the control collection.
So, I thought something like this would work:
var toInclude = new List<int>{1, 2, 3};
var result = allObjs.Where(obj => obj.Children.All(child => toInclude.Contains(child)));
That doesn't work. It returns all entities where ANY ONE child is found in the control collection. I only want to return entities if ALL their children are found in the control collection.
I think I probably need to use a let statement, but my linq to sql is not journeyman level yet :).
Thanks for your insights.