本文介绍了如何全局或轻松地将MaxExpansionDepth全局应用到整个控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到了这样的答案:

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

但这仅适用于控制器上的单个方法。将BreezeQueryable属性应用于控制器本身会在运行时破坏整个控制器,但有以下例外:状态为ArrayStart的
令牌PropertyName将导致无效的JSON对象。路径。

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 ''.

这大概是因为并非我的(大型)微风控制器上的所有方法都返回IQueryable。

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

那么,如何为整个微风控制器更改MaxExpansionDepth?

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

感谢,
Mathias

Thanks,Mathias

推荐答案

我提交了一个拉取请求,将MaxExpansionDepth添加到控制器,而不是在每个方法上。

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

这篇关于如何全局或轻松地将MaxExpansionDepth全局应用到整个控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 12:13