And now for some exciting news: you can finally use WCF Data Services with Entity Framework 6+! Today we are uploading a new NuGet package called WCF Data Services Entity Framework Provider. This NuGet package bridges the gap between WCF Data Services 5.6.0 and Entity Framework 6+. We were able to build this provider as an out-of-band provider (that is, a provider that ships apart from the core WCF DS stack) because of the public provider work we did recently.
If you are upgrading an existing OData service to Entity Framework 6 or greater, you will need to do a couple of things:
If you are creating a new OData service and would like to use Entity Framework 6 or greater, you will need to follow similar steps:
Historically the WCF DS stack required all WCF DS-based OData services to inherit from DataService<T>. Internally, the data service would determine whether the service should use the in-box EF provider, the in-box Reflection provider, or a custom provider. When we added support for EF 6, we utilized the new public provider functionality to allow the provider to ship separately. This will allow us, for instance, to use WCF DS 5.6.0 with either EF 5, 6, or some future version. However, the new public provider functionality comes with a little bit of code you need to write. Since that code should be the same for every default EF 6 WCF DS provider, we went ahead and included a class that does this for you. EntityFrameworkDataService<T> inherits from DataService<T> and implements all the code you would need to implement otherwise. By shipping this additional class, we literally made the upgrade process as simple as changing the base type of your service.
We are heads down on getting our stacks updated to support OData v4, so we’ve had very limited resources to focus on testing this provider. We have a few automated tests and have tried a number of ad-hoc tests. That said, our coverage could be better so… we’re going to rely on you, our dear customer, to provide feedback of whether or not this provider works in your situation. If we don’t hear anything back, we’ll go ahead and release the provider in a week or so.
Thanks,The OData Team
Good News! I've tried to "Creating a new OData service with EF 6" and faced
The type 'Microsoft.OData.Service.DataService`1<T0>' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.OData.Service, Version=18.104.22.168, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. C:\Users\***\Documents\Visual Studio 2012\Projects\ODataEF6Sample\ODataEF6Sample\WcfDataService.svc.cs 17 18 ODataEF6Sample
Anyone else facing this? What's wrong?
You haveany queries visit www.kbreducation.com
If you want to strong with .net , then follow www.kbreducation.com
I get this:
Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "System.Data.Services.resources" was correctly embedded or linked into assembly "Microsoft.OData.EntityFrameworkProvider" at compile time, or that all the satellite assemblies required are loadable and fully signed
I also get this error:
The type 'Microsoft.OData.Service.DataService`1<T0>' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.OData.Service, Version=22.214.171.124, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
Hi , i have the same error please fix that
The type 'Microsoft.OData.Service.DataService`1<T0>' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.OData.Service, Version=126.96.36.199, Culture=neutral, PublicKeyToken=31bf3856ad364e35
Ditto on the:
Nevermind the alpha2 Nuget package fixes this
Same with this error:
Anyone found a fix?
I am yet to find any working MS WCF tutorial that works.
Instead of "Install-Package Microsoft.OData.EntityFrameworkProvider -Version 1.0.0-alpha1 -Pre", just execute "Install-Package Microsoft.OData.EntityFrameworkProvider -Pre".
I have been getting the following error whilst hitting an upgraded WCF Data Service
The resource contains value '<Complex Type Here>' which cannot be serialized.
at System.Data.Services.LiteralFormatter.FormatRawLiteral(Object value)
at System.Data.Services.LiteralFormatter.FormatAndEscapeLiteral(Object value)
at System.Data.Services.LiteralFormatter.DefaultLiteralFormatter.FormatLiteralWithTypePrefix(Object value)
at System.Data.Services.LiteralFormatter.DefaultLiteralFormatter.Format(Object value)
at System.Data.Services.WebUtil.GetETagValue(Object resource, ResourceType resourceType, ICollection`1 etagProperties, IDataService service, Boolean getMethod)
at System.Data.Services.WebUtil.CompareAndGetETag(Object parentEntityResource, Object parentEntityToken, ResourceSetWrapper container, IDataService service, Boolean& writeResponseForGetMethods)
at System.Data.Services.DataService`1.CompareETagAndWriteResponse(RequestDescription description, IDataService dataService, IODataResponseMessage responseMessage)
at System.Data.Services.DataService`1.SerializeResponseBody(RequestDescription description, IDataService dataService, IODataResponseMessage responseMessage)
at System.Data.Services.DataService`1.HandleNonBatchRequest(RequestDescription description)
Hi, ask a question about Edm.DateTime atom format:
default: yyyy "-" mm "-" dd "T" hh ":" mm [":" ss["." fffffff]]
for example china beijing Time : 2013-10-10 08:00 , result to: 2013-10-10T00:00
what can i do , change default format, to china format？
thinks a lot.
my email: email@example.com
I'm sorray,My English bad, chinese as follow:
你好，问一个关于WCF Data Service的Edm.DateTime序列化格式的问题，
默认格式：yyyy "-" mm "-" dd "T" hh ":" mm [":" ss["." fffffff]]
比如 中文北京时间：2013-10-10 08:00，默认输出变成：2013-10-10T00:00
The EntityFrameworkDataService<T> is not exposing properties such as CurrentDataSource of the parent DataService<T>. It has a method called CreateDataSource(). Am I missing something?
Please disregard my previous question (error in FormatRawLiteral). The problem disappeared after restarting visual studio.
When using the EntityFrameworkDataService, I would expect to be able to use CurrentDataSource and override CreateDataSource just as with DataService<T>. Am I missing something here? Thanks!