复杂类型'MyData.AssetReading'通过属性'Asset'引用实体类型'MyData.Asset'

The complex type 'MyData.AssetReading' refers to the entity type 'MyData.Asset' through the property 'Asset'

着眼于设置 Web API odata 并尝试将我们的 edmx 中的数据公开给它。问题是,每次我向 OdataConventionBuilder 添加一个实体时,我都会在加载时收到一条令人讨厌的大错误消息:

The complex type 'MyData.AssetReading' refers to the entity type 'MyData.Asset' through the property 'Asset'

似乎在 edmx 中定义的关系正在将 webapi odata 轰炸出一个复杂的类型。关于如何解决这个问题的任何想法,因为 edmx 是巨大的,并且对它进行重新调整几乎是不可能的。我需要在 Builder.EntitySet 或 MapOdataRoute 方法上设置 属性 吗?

此错误消息是由于 OData V4 的当前 Web API 版本不支持在模型中的复杂类型上定义导航属性引起的。 IE。复杂类型还不能引用实体类型。

此 GitHub 问题跟踪了这项工作:https://github.com/OData/WebApi/issues/65。如果您希望它被优先考虑,请通过评论来权衡。