Quantcast
Channel: ASP.NET MVC / Web API / Web Pages
Viewing all articles
Browse latest Browse all 7925

Edited Feature: Cannot use $select on value objects [1142]

$
0
0
OData endpoints sometimes need to serve up complex objects with quite a few root level properties. Typically these are modeled as value objects, so I might have the following:

* Customer entity
* Value object for PrimaryAddress
* Entity association for Country

Typically consumers want to select fields from value objects in the same manner as fields from entities. A consumer can legally select child fields from entities like this ($expand must be used):

* /odata/customers?$top=10&$expand=Country&$select=Country/Name

Whereas if a consumer tries to select fields from value objects like this:

* /odata/customers?$top=10&$select=PrimaryAddress/Line1

Then the following error is returned:

* 'Inner or start path segments must be navigation properties in $select'

I understand that value objects like PrimaryAddress are not navigation properties so I cannot use $expand with them. It feels natural for consumers to be able to pull just the fields they need via $select though.

So just thought I'd ask if this is expected behaviour or if this is expected to change for the next Web API release?

Viewing all articles
Browse latest Browse all 7925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>