Compact (and name) the amount of SQL Parameters
The amount of duplicate SQL Parameters are too damn high :-)
eventhough i in C# declare the inputs as variables, the SQL parameters are duplicated pr use of the paramenter.
eg:
var DS = 127;
var genart = "00402";
var critno = 100;
becomes :
-- Region Parameters
DECLARE @p0 Int SET @p0 = 100
DECLARE @p1 VarChar(1000) SET @p1 = '00402'
DECLARE @p2 NVarChar(1000) SET @p2 = '-1'
DECLARE @p3 Int SET @p3 = 100
DECLARE @p4 Int SET @p4 = 2
DECLARE @p5 VarChar(1000) SET @p5 = '00402'
DECLARE @p6 NVarChar(1000) SET @p6 = '-1'
DECLARE @p7 Int SET @p7 = 2
DECLARE @p8 Int SET @p8 = 127
-- EndRegion
As you can clearly see, multiple parameters are duplicates containing the same values - which make it cumbersome to use the generated SQL.
Also the anonymous naming @p0 -> @pN makes it even harder to use the parameters ...
therefore: Compact and Name the parameters better
-
Martin Kirk commented
Also... anonymous LINQ parameters could be named by their use:
var res = from t in table where t.MyCol == 25 select t;
should infer the name into this SQL :
DECLARE @MyCol Int SET @MyCol = 25