Query to Reduce Matrix

I'm using NDepend to write a query to extract a subset of my assemblies and their dependent assemblies into a Dependency Matrix.

I would like to further reduce the size of the matrix to show only dependent assemblies that have a small or medium coupling (the ones that would be relatively easy to decouple) Therefore I only want to show the assemblies that have < 20 method usages.

how do I update this query to show this?

let agentAssemblies =Assemblies.WithNameLike("Agent")
let assembliesUsedByAgents = Assemblies.ExceptThirdParty().UsedByAny(agentAssemblies)
from a in agentAssemblies.Union(assembliesUsedByAgents )
select a

You can refine the query this way:

let agentAssemblies = Assemblies.WithNameLike("Agent")
let assembliesUsedByAgents = Assemblies.ExceptThirdParty().UsedByAny(agentAssemblies)

from a in assembliesUsedByAgents 
let methodsUsedFromAgentAssemblies = a.ChildMethods.UsedByAny(agentAssemblies)
where methodsUsedFromAgentAssemblies.Count() < 20
let agentAssembliesMethodsUsingMe = agentAssemblies.ChildMethods().UsingAny(methodsUsedFromAgentAssemblies)
select new { 
   a, 
   methodsUsedFromAgentAssemblies , 
   agentAssembliesMethodsUsingMe 
}

From the code query result you can visualise both methodsUsedFromAgentAssemblies and agentAssembliesMethodsUsingMe ...

NDepend依赖关系查询

.. and by right clicking methods sets, you can export both sets to the Dependency Matrix to have a clear understanding of which method is calling which method.

N依赖依赖矩阵

链接地址: http://www.djcxy.com/p/37732.html

上一篇: Ndepend找到所有的程序集引用?

下一篇: 查询以减少矩阵