You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Imagine I've got a response model with a lot of properties on it. I want to configure a subset of those properties to be returned in the response if no $select is included on the request - kind of like "reasonable defaults" for most clients of the api. If the client needs more, they can $select to their heart's content. Microsoft Graph API actually behaves the same way as an example of what I mean.
Additionally, I have some collection properties of strings that, if $selected, I query the related data and project it into the response. In these cases, the full model of this related data has little meaning to the client, and projecting these related models to a collection of strings keeps the API simple and focused on what the client really needs. But I only want my application to do this in the few cases where this extra data is needed, not by default.
I'm seeing the default behavior is all non-navigation properties are included in the response.
I've played around with EntityTypeConfiguration<T>.Property(x => x.Foo).Select(SelectExpandType.Allowed) which didn't give me the result I expected. The possible values for SelectExpandType are Allowed, Disabled, and Automatic. Seeing as how all properties are included by default, I assumed Automatic is the default config assigned to all properties and that Allowed would indicate that properties can be $selected, but won't be returned "automatically" if no $select is provided.
I've also tried EntityTypeConfiguration<T>.Select(SelectExpandType.Allowed, "Foo") with no luck.
not sure if I'm configuring this wrong or if the ODataOutputFormatter isn't respecting this config?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
Imagine I've got a response model with a lot of properties on it. I want to configure a subset of those properties to be returned in the response if no
$select
is included on the request - kind of like "reasonable defaults" for most clients of the api. If the client needs more, they can$select
to their heart's content. Microsoft Graph API actually behaves the same way as an example of what I mean.Additionally, I have some collection properties of strings that, if
$select
ed, I query the related data and project it into the response. In these cases, the full model of this related data has little meaning to the client, and projecting these related models to a collection of strings keeps the API simple and focused on what the client really needs. But I only want my application to do this in the few cases where this extra data is needed, not by default.I'm seeing the default behavior is all non-navigation properties are included in the response.
I've played around with
EntityTypeConfiguration<T>.Property(x => x.Foo).Select(SelectExpandType.Allowed)
which didn't give me the result I expected. The possible values forSelectExpandType
areAllowed
,Disabled
, andAutomatic
. Seeing as how all properties are included by default, I assumedAutomatic
is the default config assigned to all properties and thatAllowed
would indicate that properties can be$select
ed, but won't be returned "automatically" if no$select
is provided.I've also tried
EntityTypeConfiguration<T>.Select(SelectExpandType.Allowed, "Foo")
with no luck.not sure if I'm configuring this wrong or if the
ODataOutputFormatter
isn't respecting this config?Beta Was this translation helpful? Give feedback.
All reactions