08 Nov
Arif Khan 0 Comments

Getting Started with Entity Framework 6 & WCF Data Services

Using WCF Data Services with EF 6 and above requires some extra effort. It is not a matter of referencing assemblies or install NuGet packages, but it requires some troubleshooting as well.

To start with, we need the following NuGet packages installed:

When we access the service, we end up with the following error:
This error doesn't tell us much, so we need to get more information by decorating the service class with IncludeExceptionDetailInFaults as shown below:

As a side note, also check the access rules above. Now running the service provides more details about the error:
Now that we have more clues, a bit of Googling points to the fact that our DataService class need to inherit from System.Data.Services.Providers.EntityFrameworkDataService class and NOT System.Data.Services.DataService class.

The final working code should look like this:

Blog post currently doesn't have any comments.
 Security code