RIA Services and Inheritance in EF

只谈情不闲聊 提交于 2019-12-11 10:54:48

问题


I have the next EF diagram: Image

and the code service:

[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>();
    }
}

In the compile process I have the next errors:

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

What I can doing that except this errors?


回答1:


You can't use inheritance like that with RIA Services. Anything you load to RIA Services that requires knowledge of the inheritance is going to fail.




回答2:


Now you can: http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=RiaServices&DownloadId=8351



来源:https://stackoverflow.com/questions/1508334/ria-services-and-inheritance-in-ef

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!