3

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, -SumitPlease see the attached image

Bathla
  • 125
  • 9
  • Have you installed the [RIAServices.EntityFramework](http://nuget.org/packages/RIAServices.EntityFramework) NuGet package? – bricelam Oct 11 '12 at 16:55
  • Hi Brice! yes I have installed the NuGet package. Still does not work – Bathla Oct 12 '12 at 07:12

3 Answers3

3

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.

Jehof
  • 34,674
  • 10
  • 123
  • 155
  • the KB article link works for me, but the read more line (1st link) is broken – Mario Feb 22 '13 at 20:56
  • @Mario Thanks' will update the link. There was also an update to wcf ria service to solve the descriped problem. I will update my question with all relevant data soon – Jehof Feb 23 '13 at 15:13
0

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

mCasamento
  • 1,413
  • 1
  • 11
  • 21
0

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.

Rus
  • 1,827
  • 1
  • 21
  • 32