在我的模型中,我将Address
作为基类,MailingAddress
,Email
和Phone
作为Address的子类。一个Person
有一个地址,以便查询得到谁拥有奥克兰邮寄地址的人应该是这样的:Linq查询包括子类型
var peopleInOakland = from p in entities.DbObjectSet.OfType<Person>()
from a in p.Addresses.OfType<MailingAddress>()
where a.City == "Oakland"
select p;
我怎么也包括人的邮寄地址在我的查询结果?我知道我应该使用Include,但我不确定如何在.Include
参数中命名MailingAddress
。
在此先感谢
很高兴知道为什么这是低票。 – Richard 2009-04-07 23:06:03