问题描述
当使用EF Code First时,出现在VS 2012中的WCF RIA服务向导(在添加新的DomainService时运行)无法识别项目中定义的DbContext(它只能识别ObjectContext)。这意味着当在VS2012中添加新项目并选择添加DomainServiceClass时,该向导无法检测可用的上下文类*组合列表为空*
请看附件
有什么想法可能发生在这里?
谢谢,
-Sumit
这是Visual Studio 2012,WCF RIA服务和实体框架的一个已知问题,因为向导创建新的域服务不知道DbContext类型。
简单的解决方案是继续使用Visual Studio 2010创建实体模型。虽然使用RIAServices.EntityFramework NuGet软件包没有工作,因为它不支持当前的实体框架版本。
另一个解决方案是将您的上下文的类型从 DbContext
to ObjectContext
。
Theres还有一个针对该具体情况。
更新:
WCF的更新Ria Services已发布,以支持EF 5和DbContext的使用。更多信息可以找到。
When using EF Code First, It appears WCF RIA Services Wizard (that runs when adding a new DomainService) in VS 2012 does not recognize the DbContexts defined in the project (it only recognizes the ObjectContext).
This means that when Adding a New Item in VS2012 and choosing Add DomainServiceClass, the wizard is not able to detect available context classes * combo list is empty *
Please see the attached image
Any idea what could be happening here?Thanks,-Sumit
This is a known issue with Visual Studio 2012, WCF RIA Services and Entity Framework, cause the Wizard to create new Domain Services doesn´t know the DbContext types.
The simple solution is to continue using Visual Studio 2010 to create Entity Models. Although using RIAServices.EntityFramework NuGet package won´t work, cause it doesn´t support current Versions of Entity Framework.
Another solution is to change the type of your Context from DbContext
to ObjectContext
.
Theres also a KB article for that specific scenario.
Update:An update to WCF Ria Services was released to support EF 5 and the usage of DbContext. More information can be found here.
这篇关于WCF Ria服务向导不使用CodeFirst的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!