ninjanye / SearchExtensions

Library of IQueryable extension methods to perform searching

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to do sub-queries?

jfrank14 opened this issue · comments

I need to do a ContainingAll query on an object's scalar properties and that of a child collection object.

q = q.Search(Function(t) t.Name,
    Function(t) t.ClassName,
    Function(t) t.OrderNumber).
    ContainingAll(fields).
    Where(Function(t) t.Contacts.Search(Function(x) x.Name).ContainingAll(fields).Any)

That t.Contacts property is itself a collection that I need to search, but doing it this way throws the exception System.NotSupportedException: 'LINQ to Entities does not recognize the method 'NinjaNye.SearchExtensions.EnumerableStringSearch'1[Suntex.FirstInMath.Models.Api.Admin.Teams+Contact] ContainingAll(System.String[])' method, and this method cannot be translated into a store expression.'

Is there a way to do this kind of sub-query?