简体   繁体   中英

Where clause in LINQ Query with Entity Framework

I am trying to filter a LINQ query, but it's not accepting my where clause and I have no idea what kind of Lambda function to use.

This is what I want, but this throws an error.

var query = from s in _db.Students where s.Payments == null orderby s.LastName select s;

假设“ Payments不是“ Students的字段,而是代表与该“ Student相关的“ Payment项集合的属性,请尝试以下查询:

var query = from s in _db.Students where !s.Payments.Any() orderby s.LastName select s;

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