我想通過EntityFramework對Student實體在兩個字段中使用多個數據進行查詢。我希望所有名字和家庭的學生一起存在於過濾器中。我排除了記錄9和6返回一個查詢的結果。這個操作怎麼辦。Linq在兩個字段中包含查詢
數據在db是:
Id Name Family
-------------------------------
1 John Cooper
2 Lee Chang
3 Morgan Freeman
4 Luis Enrique
5 Jack Anderson
6 Adam Freeman
7 Bill Gates
8 David Beckham
9 Luis Figo
過濾器是:
var filters = new List<NameFamily>
{
new NameFamily{Name = "Adam", Family = "Freeman"},
new NameFamily{Name = "Luis", Family = "Figo"},
};
類是以下幾點:
public class Student
{
public int Id{get; set;}
public string Name{get; set;}
public string Family{get; set;}
}
public class NameFamilyDto
{
public string Name{get; set;}
public string Family{get; set;}
}
這並沒有解決使用EF從數據庫中拉出學生並且過濾器列表不包含實體的問題。 – Sefe