Search code examples
c#entity-frameworkodatawcf-data-servicessql-server-2016

Entity Framework DataService


I am using EntityFrameworkDataService in my WCF service to expose database views over odata end points. Following are the nuget packages in use

.Net Framework 4.5

Microsoft.Data.Edm - v5.8.1

Microsoft.Data.Services - v5.8.1

Microsoft.Data.Odata - v5.8.1

Microsoft.Data.Services.Client - v5.8.1

Microsoft.Odata.EntityFrameworkProvider – v1.0.0-beta2

We have recently migrated to SQL server 2016 and one of the Odata queries is failing at

System.Data.Services.Providers.BasicExpandProvider.ExpandedEnumerator1.get_Current()\r\n at System.Data.Services.Serializers.EntitySerializer.WriteFeedElements(IExpandedResult expanded, QueryResultInfo elements, ResourceType expectedType, String title, Func1 getRelativeUri, Func`1 getAbsoluteUri, Boolean topLevel)\r\n at System.Data.Services.Serializers.EntitySerializer.WriteTopLevelElements(IExpandedResult expanded, QueryResultInfo elements)\r\n at System.Data.Services.Serializers.Serializer.WriteRequest(QueryResultInfo queryResults)\r\n at System.Data.Services.ResponseBodyWriter.Write(Stream stream)

The OData query is something like this https://test.com/service/Entity1?$select=Prop1,Prop2&$expand=Entity2,Entity3&$filter=Prop4 eq 'test' and Prop5 ne ''

There are other Odata queries which have similar expands and filter which are working fine.

I dont know what is causing this.

Has anyone come across this ?


Solution

  • This was happening due to one of the $filter columns containing null values which was not very apparent from exception message