EF中的RIA服务和继承

时间:2009-10-02 08:33:57

标签: entity-framework wcf-ria-services

我有下一张EF图: Image

和代码服务:

[EnableClientAccess()]
public class DomainService1 : LinqToEntitiesDomainService<db1Entities1>
{
    public IQueryable<Entity1> GetMaster1()
    {
        return this.Context.Master.OfType<Entity1>();
    }

    public IQueryable<Entity2> GetMaster2()
    {
        return this.Context.Master.OfType<Entity2>();
    }
}

在编译过程中,我有下一个错误:

Error 1 The type 'TestInheritance.Web.Entity1' already contains a definition for '_typeId' D:\FAUst\SourceExamples\TestInheritance\TestInheritance\Generated_Code\TestInheritance.Web.g.cs 183
Error 2 The type 'TestInheritance.Web.Entity1' already contains a definition for 'TypeId' D:\FAUst\SourceExamples\TestInheritance\TestInheritance\Generated_Code\TestInheritance.Web.g.cs 273
Error 3 The type 'TestInheritance.Web.Entity2' already contains a definition for '_typeId' D:\FAUst\SourceExamples\TestInheritance\TestInheritance\Generated_Code\TestInheritance.Web.g.cs 310
Error 4 The type 'TestInheritance.Web.Entity2' already contains a definition for 'TypeId' D:\FAUst\SourceExamples\TestInheritance\TestInheritance\Generated_Code\TestInheritance.Web.g.cs 400

除了这个错误,我能做什么?

2 个答案:

答案 0 :(得分:2)

答案 1 :(得分:1)

您不能像使用RIA Services那样使用继承。你加载到需要了解继承知识的RIA服务的任何东西都会失败。