私は以下のように3つのエンティティを持っています。ラムダ式に含まれていないLINQステートメントへの変換
Student { StudentID, Name, Age }
Parent { ParentID, Name, Age }
StudentParent { StudentParentID, StudentID, ParentID }
特定の年齢で、親を持たないIQueryableのリストを取得する必要があります。私は現在、動作する次のコードを使用しています。
IQueryable<Student> Student s = from s in db.Students
where s.Age == 18
where !(from sp in db.StudentParent where sp.StudentID == s.StudentID select sp.StudentID).Contains(s.StudentID)
select s;
私はこれをラムダ式に変換するのを助けたいと思います。
少し前に尋ねられた同様の質問がありました:http://stackoverflow.com/questions/3739246/linq-to-sql-not-contains-or-not-in。答えはこれまでの回答よりも少し簡潔です。 –