【发布时间】:2009-04-07 19:46:04
【问题描述】:
在我的模型中,Address 作为基类,MailingAddress、Email 和 Phone 作为 Address 的子类。 Person 有一个地址,因此查询拥有奥克兰邮寄地址的人如下所示:
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。
提前致谢
【问题讨论】:
标签: c# linq entity-framework