How to apply MaxExpansionDepth globally or to an entire controller in breeze

Deadly 提交于 2019-12-02 21:40:57

问题


I found this SO answer: MaxExpansionDepth with latest webapi and breeze

But this only applies to a single method on the controller. Applying the BreezeQueryable attribute to the controller itself breaks the entire controller at runtime with this exception: Token PropertyName in state ArrayStart would result in an invalid JSON object. Path ''.

This is presumably because not all of the methods on my (large) breeze controller return IQueryable.

So, how do I change MaxExpansionDepth for my entire breeze controller? The BreezeControllerAttribute seems to accept all of the BreezeQueryableAttribute parameters EXCEPT MaxExpansionDepth.

Thanks, Mathias


回答1:


We can look into offering the Web API Queryable attributes on the BreezeControllerAttribute and applying your settings as the default values when we qualify the controller query methods. Please vote for this on "User Voice"

Meanwhile, you know it is open source. You can implement your own version of BreezeControllerAttribute.




回答2:


I submitted a pull request to add the MaxExpansionDepth to a controller rather than on each methods. https://github.com/IdeaBlade/Breeze/pull/35



来源:https://stackoverflow.com/questions/21635376/how-to-apply-maxexpansiondepth-globally-or-to-an-entire-controller-in-breeze

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