You are currently offline, waiting for your internet to reconnect

"Some Entity Framework context classes may have been excluded" message when adding a new Domain Service Class

When adding a new Domain Service Class to an ASP.NET web application in Visual Studio 2012, the 'Add New Domain Service Class' wizard shows the following message:

Some Entity Framework context classes may have been excluded.
More information can be found in the knowledge base.

The 'Available context classes' list excludes Entity Framework models that were expected to be available.

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. The 'Add New Domain Service Class' wizard detects when a 'DbContext' class has been created in your project and displays the message.

Because of the incompatibility, you will not be able to select your 'DbContext' based context class in the 'Available context classes' list.
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
  2. (If needed, click in the "white space" of the designer to ensure no objects within the model are selected)
  3. In the Properties window, change the "Code Generation Strategy" from "None" to "Default"
  4. Delete the two ".tt" files that are adjacent to the model, with the assumption that you have not modified these files beyond their original state when the entity model was created. If you have modified these files, then customizations to your entity model will be lost.
  5. 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.

More information
Steps to Reproduce the Behavior
  1. Create a new "Silverlight Business Application" project in Visual Studio 2012
  2. Add a database to the App_Data folder
  3. Add an Entity Framework model (ADO.NET Entity Data Model), generating it from your database
  4. Build the solution
  5. Add a Domain Service Class, opening the 'Add New Domain Service Class' item template wizard

Windows Communication Foundation WCF RIA Services Entity Framework ADO.NET Entity Data Model Domain Service Class Context Classes
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.

Article ID: 2745294 - Last Review: 11/16/2012 21:02:00 - Revision: 4.0

Windows Communication Foundation RIA Services

  • kbtshoot KB2745294