English 中文(简体)
CQL request composition
原标题:
  • 时间:2011-03-07 17:26:15
  •  标签:
  • ndepend
  • cql

Is it possible to compose requests in CQL ?

I would like to write something like:

SELECT TYPES FROM ASSEMBLIES "myassemblie" WHERE IsUsing SELECT METHODS FROM ASSEMBLIES "myotherassemblie" WHERE IsStatic

Thanks, Vans

最佳回答

The NDepend team is proud to finally provides an elegant answer to this question :) Thanks to the new NDepend v4 Code Query LINQ (CQLinq) feature, what you are asking for can be written for example like:

let staticMethods = Application.Assemblies.WithName("nunit.core")
                    .ChildMethods().Where(m => m.IsStatic)

from t in Application.Assemblies.WithName("nunit.util")
          .ChildTypes().UsingAny(staticMethods )

let staticMethodsUsed = staticMethods.UsedBy(t)
select new { t, staticMethodsUsed  }

There are many other ways to write such query, but this way is certainly the most concise and optimized one (the top-right panel tells it is executed in 4ms):

Code Query Composition through CQLinq

问题回答

暂无回答




相关问题
Building CQL in NDepend for verifying MVVM patterns

I wanted to verify few design patterns in C# code by static analysis. I want to verify these using NDepend. The application is built with MVVM design style, so typical design patterns that I would ...

CQL request composition

Is it possible to compose requests in CQL ? I would like to write something like: SELECT TYPES FROM ASSEMBLIES "myassemblie" WHERE IsUsing SELECT METHODS FROM ASSEMBLIES "myotherassemblie" WHERE ...

Ndepend CQL to query types out of assembly wildcard

In order to determine what low-level framework types a web application is directly using, one has to define each and every assembly involved. SELECT TYPES FROM ASSEMBLIES "Company.System.Framework", "...

How to restrict NDepend methods query on type attribute

I m trying to get NDepend to identify long methods using a modified version of the standard "Methods too big" query. I don t want to report long methods that the developers have little control over, ...

热门标签