I have a list of customers, and each customer itself has a list of contacts. To check if either the customer or a contact contains a certain name I would do the following query (in Entity Framework and LINQ):
Which means: look inside the customer.Name or every contact belonging to the customer and look inside contact.LastName if it contains the filter-string.
Big question: how can this be done by creating a (Composite-) FilterDescriptor so that a QueryableCollectionView gets filtered correctly? First part is easy, but the second part "cust.Contacts.Any(...)" makes me a headache.
Regards
Neils
query.Where
(cust => cust.Name.Contains(filter) ||
cust.Contacts.Any(contact => contact.LastName.Contains(filter)));
Which means: look inside the customer.Name or every contact belonging to the customer and look inside contact.LastName if it contains the filter-string.
Big question: how can this be done by creating a (Composite-) FilterDescriptor so that a QueryableCollectionView gets filtered correctly? First part is easy, but the second part "cust.Contacts.Any(...)" makes me a headache.
Regards
Neils