英文:
How to Use OpenRiaServices with Entity Framework 6.4.4
问题
I am trying to use Entity Framework 6.4.4 inside a .net6 project. I was able to create the .edmx file and was able to generate the entities. All is working well. Now I want to use Open Ria Services to create LinqToEntitiesDomainService. But the problem is, the LinqToEntitiesDomainService<TContext> expects ObjectContext as TContext but I am working with EF 6 and I have DB context.
Can anyone tell me what am I doing wrong? Their nuget package description claims that it works with EF6.4.4 but so far I can't make it work with EF6.4.4 due to DBContext vs ObjectContext issue.
英文:
I am trying to use Entity Framework 6.4.4 inside a .net6 project. I was able to create the .edmx file and was able to generate the entities. All is working well. Now I want to use Open Ria Services to create LinqToEntitiesDomainService. But the problem is, the LinqToEntitiesDomainService<TContext> expects ObjectContext as TContext but I am working with EF 6 and I have DB context.
Can anyone tell me what am I doing wrong? Their nuget package description claims that it works with EF6.4.4 but so far I can't make it work with EF6.4.4 due to DBContext vs ObjectContext issue.
答案1
得分: 0
经进一步调查代码,我意识到我不必使用 LinqToEntitiesDomainService
,而应该使用 DbDomainService
,因为前者适用于 ObjectContext
(EF < 4),而后者适用于 DbContext
(EF > 4)。
不管是我在浏览的帮助文档中缺少了这一重要信息,还是我自己忽略了它。不过,我的问题现在已经解决。
英文:
Upon further investigation into the code, I realized that I don't have to use LinqToEntitiesDomainService
but instead DbDomainService
since the former works with ObjectContext
(EF < 4) and the later works with DbContext
(EF > 4).
Either this critical information was missing from the Help docs I went through or I missed it. Nonetheless, my issue is resolved now.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论