Skip to content

Commit 1382da6

Browse files
committed
Revert ISqlFormatter to old API signature (#68).
Extensions to ISqlFormatter and VerboseSqlFormatter from #48 postponed to v3.1. Nuget to v3.0.12
1 parent 590352a commit 1382da6

File tree

7 files changed

+20
-12
lines changed

7 files changed

+20
-12
lines changed

MiniProfiler.nuspec

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<package>
33
<metadata>
44
<id>MiniProfiler</id>
5-
<version>3.0.11</version>
5+
<version>3.0.12</version>
66
<authors>Marc Gravell, Jarrod Dixon, Yaakov Ellis, Nick Craver</authors>
77
<owners>Marc Gravell, Jarrod Dixon, Yaakov Ellis, Nick Craver</owners>
88
<description>Lightweight mini-profiler, in particular designed for ASP.NET MVC sites</description>
99
<projectUrl>http://miniprofiler.com</projectUrl>
1010
<licenseUrl>http://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
1111
<tags>profiler sql mvc asp.net performance profiling timing</tags>
1212
<language>en-US</language>
13-
<releaseNotes>See https://github.com/MiniProfiler/dotnet/releases for more info</releaseNotes>
13+
<releaseNotes>Restores API signature for ISqlFormatter (see issue #68). VerboseSql and enhanced stored procedures pushed to v3.1. See https://github.com/MiniProfiler/dotnet/releases for more info</releaseNotes>
1414
</metadata>
1515
<files>
1616
<file src="StackExchange.Profiling\bin\Release\MiniProfiler.*" target="lib\net40" />

StackExchange.Profiling.Tests/SqlFormatterTest.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ private void CreateDbCommand(CommandType commandType)
3939
private string GenerateOutput()
4040
{
4141
var sqlParameters = SqlTiming.GetCommandParameters(_dbCommand);
42-
var output = _formatter.FormatSql(_commandText, sqlParameters, _dbCommand);
42+
var output = _formatter.FormatSql(_commandText, sqlParameters);
4343
return output;
4444
}
4545

@@ -99,6 +99,8 @@ private static DbType GetDbType(Type type)
9999
return _dbTypeMap[type.TypeHandle];
100100
}
101101

102+
// Code being removed for v3.0.x to maintain semver versioning. Will be present in v3.1+
103+
/*
102104
[Test]
103105
public void EnsureVerboseSqlServerFormatterOnlyAddsInformation()
104106
{
@@ -114,7 +116,7 @@ public void EnsureVerboseSqlServerFormatterOnlyAddsInformation()
114116
115117
// assert
116118
Assert.AreEqual(expectedOutput, actualOutput);
117-
}
119+
}*/
118120

119121
[Test]
120122
public void TabelQueryWithoutParameters()

StackExchange.Profiling/SqlFormatters/ISqlFormatter.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ public interface ISqlFormatter
1111
/// <summary>
1212
/// Return SQL the way you want it to look on the in the trace. Usually used to format parameters.
1313
/// </summary>
14-
string FormatSql(string commandText, List<SqlTimingParameter> parameters, IDbCommand command = null);
14+
string FormatSql(string commandText, List<SqlTimingParameter> parameters);
1515
}
1616
}

StackExchange.Profiling/SqlFormatters/InlineFormatter.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public InlineFormatter(bool includeTypeInfo = false)
2828
/// Formats the SQL in a generic friendly format, including the parameter type information
2929
/// in a comment if it was specified in the InlineFormatter constructor
3030
/// </summary>
31-
public string FormatSql(string commandText, List<SqlTimingParameter> parameters, IDbCommand command = null)
31+
public string FormatSql(string commandText, List<SqlTimingParameter> parameters)
3232
{
3333
if (parameters == null || parameters.Count == 0)
3434
{

StackExchange.Profiling/SqlFormatters/SqlServerFormatter.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ static SqlServerFormatter()
5959
/// <summary>
6060
/// Formats the SQL in a SQL-Server friendly way, with DECLARE statements for the parameters up top.
6161
/// </summary>
62-
public virtual string FormatSql(string commandText, List<SqlTimingParameter> parameters, IDbCommand command = null)
62+
public virtual string FormatSql(string commandText, List<SqlTimingParameter> parameters)
6363
{
6464
StringBuilder buffer = new StringBuilder();
6565

@@ -72,15 +72,18 @@ public virtual string FormatSql(string commandText, List<SqlTimingParameter> par
7272
.AppendLine();
7373
}
7474

75+
// Code being removed for v3.0.x to maintain semver versioning. Will be present in v3.1+
76+
7577
// only treat 'StoredProcedure' differently since 'Text' may contain 'TableDirect' or 'StoredProcedure'
76-
if (command != null && command.CommandType == CommandType.StoredProcedure)
78+
/*if (command != null && command.CommandType == CommandType.StoredProcedure)
7779
{
7880
GenerateStoreProcedureCall(commandText, parameters, buffer);
7981
}
8082
else
8183
{
8284
buffer.Append(commandText);
83-
}
85+
}*/
86+
buffer.Append(commandText);
8487

8588
string formattedText = TerminateSqlStatement(buffer.ToString());
8689
return formattedText;

StackExchange.Profiling/SqlFormatters/VerboseSqlServerFormatter.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44

55
namespace StackExchange.Profiling.SqlFormatters
66
{
7-
/// <summary>
7+
// Code being removed for v3.0.x to maintain semver versioning. Will be present in v3.1+
8+
9+
/*/// <summary>
810
/// Formats SQL server queries with a DECLARE up top for parameter values
911
/// </summary>
12+
///
1013
public class VerboseSqlServerFormatter : SqlServerFormatter
1114
{
1215
/// <summary>
@@ -33,5 +36,5 @@ public override string FormatSql(string commandText, List<SqlTimingParameter> pa
3336
3437
return buffer.ToString();
3538
}
36-
}
39+
}*/
3740
}

StackExchange.Profiling/SqlTiming.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public SqlTiming(IDbCommand command, SqlExecuteType type, MiniProfiler profiler)
3535

3636
if (MiniProfiler.Settings.SqlFormatter != null)
3737
{
38-
commandText = MiniProfiler.Settings.SqlFormatter.FormatSql(commandText, parameters, command);
38+
commandText = MiniProfiler.Settings.SqlFormatter.FormatSql(commandText, parameters);
3939
}
4040

4141
_customTiming = profiler.CustomTiming("sql", commandText, type.ToString());

0 commit comments

Comments
 (0)