问题
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