How do you query .Net source for methods containing a string using NDepend?

StackOverflow https://stackoverflow.com/questions/16361608

  •  14-04-2022
  •  | 
  •  

Question

I would like to find out all classes that have an inline SQL Statement in them. How do you write an NDepend CQL query that scans the method body looking for the use of say "Select"? Is it possible?

Thanks in Advance.

Était-ce utile?

La solution

NDepend is more about code structure, code quality, code metrics, code diff ... It doesn't know about string constants content, so this is not the right tool for what you need to do.

For that I'd advise using Mono.Cecil which is an assembly content reader API (OSS/free) pretty well done! Btw NDepend relies on Cecil for reading assemblies and I can say it is a great API with high performances and pretty close to bug free!.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top