Odata expand query result by default

本小妞迷上赌 提交于 2019-12-31 04:56:25

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!