到目前为止,我想我可以做相关的表:查询使用EF“包括”包括其中
var num = db.MyTable.Include(x => x.RelatedTable)
.Count(x.idTenant == CurrentTenantID && x.Active &&
x.RelatedTable.SomeProperty.Value == true);
这总是返回零个记录。 我是否错误地认为包括RelatedTable我可以在where部分使用它?
顺便说一下......“SomeProperty”是可为空的,这就是为什么“.Value”。
我正在使用实体框架4.1。 (数据库优先)
谢谢,我认为在这种情况下“包含”是强制性的。 – Romias 2012-07-10 15:59:12