【问题标题】:How can I use Include method in entity framework 4.3 for an abstract type?如何将实体框架 4.3 中的 Include 方法用于抽象类型?
【发布时间】:2012-06-05 14:16:06
【问题描述】:

我有一个 Order 类,它链接到 OrderLine 列表,这是一个抽象类型。

我想在 OrderLine 的其中一个子类上发出 Include,例如 ProductOrderLine,它上面有 Product 属性:

类似:

data.Orders.Include(x=>x.Lines).Include("Lines.Product");

显然这会导致失败,所以我需要一种指定子类型的方法。

谢谢

【问题讨论】:

标签: linq-to-entities entity-framework-4.1 poco


【解决方案1】:

包含在继承层次结构中的是not supported。您只能包含来自基类型的属性。

【讨论】:

    猜你喜欢
    • 2011-08-31
    • 1970-01-01
    • 2017-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多