When I port a NDepend CQLinq query to C# I must allways start defining a codeBase to query to, so this CQLinq query
from m in Methods
where m.ILCyclomaticComplexity > 10
select new {m}
using NDepend API in C# I must port to:
ICodeBase codeBase
from m in codeBase.Application.Methods
where m.ILCyclomaticComplexity > 10
select m
I see there is a ICQLinqExecutionContext. Can I define the context for the queries so I can directly use Assemblies, Methods, JustMyCode, ...etc?
Thanks!
As explaine in the ICQLinqExecutionContext doc: This interface is reserved for CQLinq implementation usage and is not intended to be used in your code.
But as you noticed, with just a little bit of rewritten, you can access 100% of CQLinq features (like using codeBase.Application.Methods
intead of just Methods
)
Also by reading the CQLinq syntax doc about predefined domain, you can see that a domain like Methods
in CQLinq gets translated to context.CodeBase.Methods
at CQLinq post-compilation time. What you are really missing is not the interface ICQLinqExecutionContext
but CQLinq post-compilation time that is not available in C#.