假设我有3个表:Table Employee,EmploymentHistory和Languages。一名员工可以拥有许多语言和工作经历。
员工
ID Name Email
1 AAA aaa@gmail.com
2 BBB bbb@gmail.com
3 CCC ccc@gmail.com
就业历史
ID EmployeeID Company Position
1 1 Devon Energy aaa
2 2 Emric bbb
3 3 Capcom ccc
语言
ID EmployeeID Language Level
1 1 English Expert
2 2 Dutch Expert
3 3 Franch Expert
如何使用ObjectQuery QueryBuilder应用过滤器?示例:我想用devon公司过滤员工。它应该是员工“AAA”。
var emp = Translate(context.Employees.Include("EmploymentHistories"));
public ObjectQuery<T> Translate<T>(ObjectQuery<T> objectQuery)
{
objectQuery.Where("it.EmploymentHistories.Company = 'Devon Energy'"); // EmploymentHistories.Company is not found. How can I filter through it included property
}
注意:我正在使用QueryBuilder进行高级过滤。
致以最诚挚的问候,
布赖恩