Get records based on child condition
- by Shawn Mclean
In LINQ To Entities: How do I get the records (including both child and parent) based on a condition of the child in a one to many.
My structure is set up as follows:
GetResources() - returns a list of Resources.
GetResources().ResourceNames - this is the child, which is an entity collection.
GetResources().ResourceNames - a property of one record of this child is Name.
I'd like to construct something like this:
return (from p in repository.GetResources()
where p.ResourceNames.Exist(r => r.Name.Contains(text, StringComparison.CurrentCultureIgnoreCase))
select p).ToList();
but of course, Exist doesn't exist.
thanks.