鉴于这些课程,
public class Foo
{
...
public IList<Bar> BarList{ get; set; }
}
public class Bar
{
...
public int Property{ get; set; }
}
当Property是列表中对象的属性时,如何让LINQ创建一个过滤Property的值匹配的查询?
即,我想返回所有记录,其中OtherTable的Property列的值与Foo.BarList中存在的任何属性值相匹配。像
这样的东西var result = db.MainTable.Include(m => m.OtherTable.Where(o => o.Property == {{Foo.BarList.Property}}) ...rest of query
谢谢。