BT

WCF Data Services 5.6.0 Adds Entity Framework 6 Support

by Anand Narayanaswamy on Oct 08, 2013 |

Microsoft has released WCF Data Services 5.6.0 as a NuGet package with support for Entity Framework 6+ and should be used in addition to the EntityFramework and Microsoft.Data.Services NuGet packages.

In order to create a new OData service with Entity Framework 6 you should make use of a ASP.NET Empty Web Application, create an App_Data folder, install WCF Data Services Entity Framework Provider NuGet package and add a new WCF data service. You will be required to upgrade other NuGet packages in your project since the latest release depends upon EF6.

Finally, replace the base type of the DataService that was generated by the item template. If you make use of EF 6 then your data service should inherit from EntityFrameworkDataService<T> where T is a DbContext.

In order to install WCF Data Services Entity Framework Provider run the following command in the Package Manager Console

PM> Install-Package Microsoft.OData.EntityFrameworkProvider -Version 1.0.0-alpha1 -Pre

You can also upgrade an existing OData service to EF 6 by replacing the base type of your DataService and should inherit from EntityFrameworkDataService<T> where T is a DbContext.

The official blog post of the OData product team examines the key difference between DataService<T> and EntityFrameworkDataService<T>.

 

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT