问题
Is there a way to auto expand nested entity in the response with odata 5.7?
Because by default we have to add ?$expand=myNestedEntity
回答1:
In your entity class definition, use the AutoExpand atttribute on the navigation properties you would like to have expanded.
回答2:
As an alternative, this can be accomplished with fluent api
.
builder.EntitySet<MyType>("MyType").EntityType.Expand(SelectExpandType.Automatic, "ExpandedField1", "ExpandedField2");
来源:https://stackoverflow.com/questions/35907701/odata-expand-query-result-by-default