假设我有 3 个表:表 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 进行高级过滤。
此致,
布赖恩