问题
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