NDepend:如何将JustMyCode限制为x使用的方法



官方文档解释了如何使用notmycode 通过排除来限制JustMyCode

notmycode from m in Methods where
m.SourceFileDeclAvailable && 
m.SourceDecls.First().SourceFile.FileName.ToLower().EndsWith(".designer.cs")
select m

我想将JustMyCode限制为此查询返回的方法

from m in Methods 
let depth0 = m.DepthOfIsUsedBy("InsertMuk(Int32,Int32,BetCoupon,Boolean,Boolean,Boolean,DateTime&,Boolean)")
where depth0  >= 0 orderby depth0
select new { m, depth0 }

它会为所有其他查询重新定义代码库吗?

假设您禁用了所有其他notmycode查询,并且在字符串中提供了Namespace.ClassName,则此查询应该可以工作

notmycode
let methodsUsed =  Methods.Where(m1 => m1.DepthOfIsUsedBy("Namespace.ClassName.InsertMuk(Int32,Int32,BetCoupon,Boolean,Boolean,Boolean,DateTime&,Boolean)") >= 0)
from m in Methods.Except(methodsUsed )
select m

相关内容

最新更新