.net - Child Objects Filter In EF -


how can filter child objects entity framework criteria? example: have object company childobjects, companychilds. companychilds have property active. want company exact id , child objects active equals true.

i tried this:

dbcontext.company.include("childcompany").where(x => x.id == id  && x.childcompany.any(y => y.active == true)); 

any welcome :)

there way filter child records in code first api -- see post: http://blogs.msdn.com/b/adonet/archive/2011/01/31/using-dbcontext-in-ef-feature-ctp5-part-6-loading-related-entities.aspx see "applying filters when explicitly loading related entities"


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -