0
複合型をキャストトリップクエリエラー、私はこのクエリを要求しようとしています:のOData:
http://services.odata.org/V4/TripPinService/People('russellwhyte')/AddressInfo/Microsoft.OData.SampleService.Models.TripPin.AirportLocation
だから、私はPeople('russellwhyte')
からすべてのAirportLocation
を取得しようとしています。しかし、私は、このエラーメッセージが出てい:
<ComplexType Name="Location" OpenType="true">
<Property Name="Address" Type="Edm.String" Nullable="false" />
<Property Name="City" Type="Microsoft.OData.SampleService.Models.TripPin.City" Nullable="false" />
</ComplexType>
<ComplexType Name="EventLocation" BaseType="Microsoft.OData.SampleService.Models.TripPin.Location" OpenType="true">
<Property Name="BuildingInfo" Type="Edm.String" />
</ComplexType>
<ComplexType Name="AirportLocation" BaseType="Microsoft.OData.SampleService.Models.TripPin.Location" OpenType="true">
<Property Name="Loc" Type="Edm.GeographyPoint" Nullable="false" SRID="4326" />
</ComplexType>
だからLocation
複合型AirportLocation
とEventLocation
の基本型である:
"error": {
"code": "InternalServerError",
"message": "Type cast segment 'Microsoft.OData.SampleService.Models.TripPin.AirportLocation' after a collection which is not of entity type is not allowed.",
"innererror": {...
}
これはLocation
複合型関連のスキーマです。
に
GetLocationsOfCnAddress
またはGetLocationsOfUsAddress
という名前のメソッドは、あなたが私にいずれかを提供できなければならないタイプIList<Address>
と
Locations
という名前のプロパティを持っています私は 'GetLocationsOfCnAddress'と' GetLocationsOfUsAddress'をなぜ持っているべきかを説明するドキュメントを手助けしていますか?一方で、実際にそのような機能をサポートしているサービスはありますか? – Jordiコンベンションルーティングに関するいくつかのドキュメントがあります:http://odata.github.io/WebApi/#03-02-built-in-routing-conventions。しかし、それはプロパティキャストは言及していません。多分あなたはコードを参照することができます:https://github.com/OData/WebApi/blob/master/src/System.Web.OData/OData/Routing/Conventions/PropertyRoutingConvention.cs#L65-L67 –