BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News WCF Data Services 5.6.0 Adds Entity Framework 6 Support

WCF Data Services 5.6.0 Adds Entity Framework 6 Support

This item in japanese

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>.

 

Rate this Article

Adoption
Style

BT