开发者

Entity Framework query to select

开发者 https://www.devze.com 2023-02-13 00:29 出处:网络
table people: SSN, name table students: SSN, school I want to get all SSN for people who are not students. How do I write开发者_如何学运维 this with entity framework?var ssnList = Context.Peoples

table people: SSN, name table students: SSN, school

I want to get all SSN for people who are not students. How do I write开发者_如何学运维 this with entity framework?


var ssnList = Context.Peoples
                     .Where( p => !Context.Students
                                          .Any(s => s.SSN == p.SSN))
                     .Select( p => p.SSN).ToList();
0

精彩评论

暂无评论...
验证码 换一张
取 消