简体   繁体   中英

Is it possible to have Where or Any expression inside Include in Linq or Lambda expression?

Something similar to this

Ex

var temp = dbcontext.ModelA.include(x=>x.ModelB.where(...))
var temp = dbcontext.ModelA.include(x=>x.ModelB.Any(...))

Yes filtered includes are supported, but only as of EF Core 5.0, which would allow you to use Where .

According to the docs:

Supported operations are: Where , OrderBy , OrderByDescending , ThenBy , ThenByDescending , Skip , and Take .

However, using Any directly does not make sense, because it returns bool rather than a subset of related entities.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM