NDepend不返回ASP.NET MVC Controller类

时间:2016-10-29 12:44:22

标签: ndepend

这是我的代码:

// <Name>test</Name>
warnif count > 0

let controllerType= ThirdParty.Types.WithFullName("System.Web.Mvc.Controller").Single()

from m in controllerType.Methods
select m

但我只能在Controller中看到这些方法:

enter image description here

但显然View是控制器的一种方法,而NDepend却没有看到它。任何人都可以指出我所缺少的东西吗?感谢。

enter image description here

[更新]

我最初的意图是根据他们返回的内容的实际类型(例如,html,fileresult,ajax结果等)对动作进行分类。要确定某个操作是否返回html,我需要检查该操作是否实际返回ViewResult,包括以下操作,其返回类型为ActionResult但实际上返回ViewResult使用View方法。

enter image description here

所以我想检查一个动作是否真的IsUsingMethod(mvcViewMethod)并且只要它调用任何View方法,我会将此动作视为返回html。但现在我无法获得对mvcViewMethod的引用。

[更新2]

根据Patrick的建议,我查看了班级浏览器,只看到了这个:

enter image description here

我没有看到任何View方法。这比我在同一个dll的ILSpy中看到的要少得多,我可以看到明确定义的View方法:

enter image description here

对于这样的行动:

enter image description here

在类浏览器中,如果我右键单击此操作并选择&#34;选择我使用的方法(直接或间接)&#34;,我将看到此查询结果:

enter image description here

我仍然无法看到它使用View方法。

[最终更新]

根据Patrick的建议,我将System.Web.Mvc dll添加到我的应用程序代码dll中,它现在运行良好:

enter image description here

0 个答案:

没有答案
相关问题