linq - LinqKit and Filter a subquery -


i have 1 many relation (ef) , want write query filters 1 relation , filters many relation.

for instance: company has many employees

write query filters on company.name = "zonsoft" , company.employees has @ least 1 employee name "hesius"

from comp in data.companies.include("employees") comp.name = "zonsoft" andalso comp.employees.any(function(em) em.name = "hesius") select comp 

this works fine, if filters not known @ compile time? user can select out of many filters (name, age, ...) , don't want write code that.

i experimenting expression , linqkit cannot make filter work on employees relation.

'

exp1 expression(of func(of company, boolean) = function(comp) comp.name = "zonsoft" exp2 expression(of func(of employee, boolean) = function(emp) emp.name = "hesius" 

how combine these 2 filters in 1 query? or how desired result?

this works: '

from comp in data.companies.include("employees") .where(exp1) select comp. 

i looking this:

from comp in data.companies.include("employees") .where(exp1 andalso comp.employees.any(exp2)) select cc 


Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -