Tuesday, June 25, 2013

Nitriq - usefull Rules. Detect method usage.


If for some reason you don't want to use the type in your code you can easy find it.

For example in our project we decided to override the behaviour for System.Data.SqlClient.SqlParameter and it is critical.

var results = 
from method in Methods
where method.IsStatic && method.IsPublic
    && method.TypesUsed.Where(typesUsed => typesUsed.FullName == "System.Data.SqlClient.SqlParameter").Count() > 0
select new { method.MethodId, method.FullName, method.Name, Usega = method.CalledBy.Count, method.ParameterCount };

Warn(results, 0);