You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have troubles using OData queries on a service based on EntityFramework.
The problem arises when we try to expand inherited back-navigation properties.
In attachment you can find a minimal example which reproduces the problem.
We have entities in the following hierarchy:
Base-->Derived-->DerivedDerived-->DerivedDerivedDerived
A back-navigation is declared on "Base" and queried on all four entity-types just to find that it only works on "Base" and "DerivedDerivedDerived" (i.e. only the least and most extended types).
The queries we tried are:
[...]/odata/Base?$expand=BackNav
[...]/odata/Derived?$expand=BackNav
[...]/odata/DerivedDerived?$expand=BackNav
[...]/odata/DerivedDerivedDerived?$expand=BackNav
Only cases 1 and 4 are working.
Cases 2 and 3 throw exception:
{ "error":{ "code":"","message":"An error has occurred.","innererror":{ "message":"The 'ObjectContent`1' type failed to serialize the response body for content type 'application/json; odata.metadata=minimal'.","type":"System.InvalidOperationException","stacktrace":"","internalexception":{ "message":"An error occurred while preparing the command definition. See the inner exception for details.","type":"System.Data.Entity.Core.EntityCommandCompilationException","stacktrace":" at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory, DbCommandTree commandTree, DbInterceptionContext interceptionContext, IDbDependencyResolver resolver, BridgeDataReaderFactory bridgeDataReaderFactory, ColumnMapFactory columnMapFactory)\r\n at ...
This is the same issue reported here: https://entityframework.codeplex.com/workitem/2903
We have troubles using OData queries on a service based on EntityFramework.
The problem arises when we try to expand inherited back-navigation properties.
In attachment you can find a minimal example which reproduces the problem.
We have entities in the following hierarchy:
Base-->Derived-->DerivedDerived-->DerivedDerivedDerived
A back-navigation is declared on "Base" and queried on all four entity-types just to find that it only works on "Base" and "DerivedDerivedDerived" (i.e. only the least and most extended types).
The queries we tried are:
[...]/odata/Base?$expand=BackNav
[...]/odata/Derived?$expand=BackNav
[...]/odata/DerivedDerived?$expand=BackNav
[...]/odata/DerivedDerivedDerived?$expand=BackNav
Only cases 1 and 4 are working.
Cases 2 and 3 throw exception:
{ "error":{ "code":"","message":"An error has occurred.","innererror":{ "message":"The 'ObjectContent`1' type failed to serialize the response body for content type 'application/json; odata.metadata=minimal'.","type":"System.InvalidOperationException","stacktrace":"","internalexception":{ "message":"An error occurred while preparing the command definition. See the inner exception for details.","type":"System.Data.Entity.Core.EntityCommandCompilationException","stacktrace":" at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory, DbCommandTree commandTree, DbInterceptionContext interceptionContext, IDbDependencyResolver resolver, BridgeDataReaderFactory bridgeDataReaderFactory, ColumnMapFactory columnMapFactory)\r\n at ...
OdataTest.zip
The text was updated successfully, but these errors were encountered: