Is there any way of printing the name out in my select new {}?
No there is no way, NDepend Code Query Linq doesn't read string constants. This is a feature we might add in the future.
Pregunta
I am maintaining a large code base which makes use of hundreds of stored procedures in SQL Server. To remove unused procedures we need to find those which are still in use. I have written a small bit of CQL that can tell me all the methods which have a dependency on SqlCommand. For the most part, use of this class is performed by wizard generated XSDs:
/// <Name>Stored Procedure Usage</Name>
from m in JustMyCode.Methods
// Find usage of the property setter (principally XSD generated code)
let depth0 = m.DepthOfIsUsing("System.Data.Common.DbCommand.set_CommandText(String)")
// Find usage of the constructor (principally manual code)
let depth1 = m.DepthOfIsUsing("System.Data.SqlClient.SqlCommand..ctor(String,SqlConnection)")
where (depth0 >= 0 || depth1 >= 0)
select new { m, m.ParentType, m.ParentAssembly }
The procedure name is a string defined inline and assigned to SqlCommand.CommandText:
this._adapter.InsertCommand.CommandText = "dbo.InsertStudentAddress";
Is there any way of printing the name out in my select new {}
?
Solución
Is there any way of printing the name out in my select new {}?
No there is no way, NDepend Code Query Linq doesn't read string constants. This is a feature we might add in the future.