如何使用 OpenRiaServices 与 Entity Framework 6.4.4

huangapple go评论50阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年5月25日 22:35:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/76333474.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定