ASP.NET Web API 2.2 OData v4 navigation property on a complex type - controller method -


i'm trying implement navigation property on complex type. according https://odata.github.io/webapi/13-02-complextypewithnavigationproperty/ supported since web api odata v6.0.0. downloaded version, created models , built odata convention model.

models:

public class city {     public int id { get; set; }     public street[] streets { get; set; } }  public class street {     public int id { get; set; }     public house[] houses { get; set; } }  public class house {     public int id { get; set; } } 

convention model:

odataconventionmodelbuilder builder = new odataconventionmodelbuilder(); builder.entityset<city>("cities").entitytype.collectionproperty(e => e.streets); builder.entityset<house>("houses"); config.mapodataserviceroute("odataroute", "api", builder.getedmmodel()); 

generated $metadata:

<edmx:edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" version="4.0"> <edmx:dataservices>     <schema xmlns="http://docs.oasis-open.org/odata/ns/edm" namespace="odata_test_3.models">         <entitytype name="city">             <key>                 <propertyref name="id"/>             </key>             <property name="addresses" type="collection(odata_test_3.models.address)" nullable="false"/>             <property name="id" type="edm.int32" nullable="false"/>         </entitytype>         <complextype name="address">             <property name="id" type="edm.int32" nullable="false"/>             <navigationproperty name="houses" type="collection(odata_test_3.models.house)"/>         </complextype>         <entitytype name="house">             <key>                 <propertyref name="id"/>             </key>             <property name="id" type="edm.int32" nullable="false"/>         </entitytype>     </schema>     <schema xmlns="http://docs.oasis-open.org/odata/ns/edm" namespace="default">         <entitycontainer name="container">             <entityset name="cities" entitytype="odata_test_3.models.city">                 <navigationpropertybinding path="addresses/houses" target="houses"/>             </entityset>             <entityset name="houses" entitytype="odata_test_3.models.house"/>         </entitycontainer>     </schema> </edmx:dataservices> </edmx:edmx> 

my question is: controller class should put method "houses" navigation property , how should like?


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -