WCF Ria Services Wizard not working with CodeFirst

本秂侑毒 提交于 2019-12-06 04:14:22

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.

I believe that the wizard don't find your class due to the fact that WCF ria is older than EF 5. Try to redirect the assembly binding to

<runtime>
    <legacyUnhandledExceptionPolicy enabled="1" />
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
      </dependentAssembly>
...

let us know if it works

This is now possible with the 4.2 release of WCF RIA Services.

If you create a WCF RIA project and get prompted to select a Windows Phone version, this is a reported issue you need remove Windows Phone 8.0 & 7.1 SDK.

If then you get an error to do with project templates perform a repair on WCF RIA 1.0 SP2 which you should have already installed.

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