|
24 | 24 | <# |
25 | 25 | var navigationProperty = c.AsOdcmProperty().GetServiceCollectionNavigationPropertyForPropertyType(); |
26 | 26 | if (navigationProperty != null) { |
| 27 | + |
| 28 | + //Append the singleton's navigation type to the @odata.id if relevant |
| 29 | + var implicitNavigationProperty = string.Empty; |
| 30 | + if (navigationProperty.GetType() == typeof(OdcmSingleton)) |
| 31 | + implicitNavigationProperty = c.AsOdcmProperty().Name + "/"; |
| 32 | + |
27 | 33 | String prop = c.AsOdcmProperty().GetServiceCollectionNavigationPropertyForPropertyType().Name; |
28 | 34 | #> |
29 | 35 | final String requestUrl = getBaseRequest().getRequestUrl().toString(); |
30 | | - final ReferenceRequestBody body = new ReferenceRequestBody(getBaseRequest().getClient().getServiceRoot() + "/<#=prop#>/" + new<#=TypeName(c)#>.id); |
| 36 | + final ReferenceRequestBody body = new ReferenceRequestBody(getBaseRequest().getClient().getServiceRoot() + "/<#=prop#>/<#=implicitNavigationProperty#>" + new<#=TypeName(c)#>.id); |
31 | 37 | new <#=TypeWithReferencesRequestBuilder(c)#>(requestUrl, getBaseRequest().getClient(), /* Options */ null) |
32 | 38 | .buildRequest(getBaseRequest().getOptions()) |
33 | 39 | .post(new<#=TypeName(c)#>, body, callback); |
34 | 40 | } |
35 | 41 |
|
36 | 42 | public <#=TypeName(c)#> post(final <#=TypeName(c)#> new<#=TypeName(c)#>) throws ClientException { |
37 | 43 | final String requestUrl = getBaseRequest().getRequestUrl().toString(); |
38 | | - final ReferenceRequestBody body = new ReferenceRequestBody(getBaseRequest().getClient().getServiceRoot() + "/<#=prop#>/" + new<#=TypeName(c)#>.id); |
| 44 | + final ReferenceRequestBody body = new ReferenceRequestBody(getBaseRequest().getClient().getServiceRoot() + "/<#=prop#>/<#=implicitNavigationProperty#>" + new<#=TypeName(c)#>.id); |
39 | 45 | return new <#=TypeWithReferencesRequestBuilder(c)#>(requestUrl,getBaseRequest().getClient(), /* Options */ null) |
40 | 46 | .buildRequest(getBaseRequest().getOptions()) |
41 | 47 | .post(new<#=TypeName(c)#>, body); |
|
0 commit comments