问题
Looking at setting up Web API odata and trying to expose the data out of our edmx to it. The problem is that every time i add an entity to the OdataConventionBuilder I get a big nasty error message on load saying:
The complex type 'MyData.AssetReading' refers to the entity type 'MyData.Asset' through the property 'Asset'
It seems for relations defined in the edmx is bombing the webapi odata out about a complex type. Any ideas on how to get around this as the edmx is huge and a rejig of it is pretty much out of the question. Is there a property that I need to set on the Builder.EntitySet or the MapOdataRoute method?
回答1:
This error message is caused by the fact that the current version of Web API for OData V4 doesn't support defining navigation properties on a complex type in the model. I.e. complex type can't refer to entity type(s) yet.
This work is tracked by this GitHub issue: https://github.com/OData/WebApi/issues/65. Weigh in by commenting it if you'd like it to be prioritized.
来源:https://stackoverflow.com/questions/28871565/the-complex-type-mydata-assetreading-refers-to-the-entity-type-mydata-asset