1
votes

I am new to WCF RIA development. I have created a silverlight 4 application with WCF ria support. Then I have created ADO.Net entity data model based on a local database file. Now when I am going to create a Domain service class the dropdown below the "available context classes" is empty and it does not show the names of tables from the datasource.

Am I missing any step here or is something not installed properly.

I am using VS 2010 & Sql server Express 2008.

3

3 Answers

7
votes

If you are running VS2012 read http://support.microsoft.com/kb/2745294 It worked for me.

Summary of the information here is:

With Visual Studio 2012, Entity Framework now creates 'DbContext' based context classes by default, but WCF RIA Services does not support 'DbContext' based context classes. In order to utilize your Entity Framework model with WCF RIA Services, you must convert it to an 'ObjectContext' based model. This can be done using the following steps:

  1. Open your entity model in the designer, change the "Code Generation Strategy" from "None" to "Default"

  2. Delete the two ".tt" files that are adjacent to the model

  3. Rebuild the project

After following those steps, you will be able to select your entity model's context class in the 'Available context classes' list. The side-effect of this procedure is that you have now converted your entity model from an Entity Framework DbContext-based model to an ObjectContext-based model.

0
votes

Check your Connection String that the Metadata resource files reference are not missing. Connection String should be like this:

<add name="conString" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.;initial catalog=DBName;persist security info=True;user id=username;password=123456;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
0
votes

If you are using code-first design then you need to add RIAServices.EntityFramework to add support for EntityFramework > 4.2 . This can be done by :

Install-Package RIAServices.EntityFramework