Skip to content

Commit 4e81ef9

Browse files
author
James Craig
committed
Package updates.
1 parent 03a80ce commit 4e81ef9

File tree

7 files changed

+53
-50
lines changed

7 files changed

+53
-50
lines changed

src/SQLHelper.DB/ExtensionMethods/DbCommandExtensions.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,13 @@ public static DbCommand AddParameter(this DbCommand command, string id, string v
7373
/// <summary>
7474
/// Adds a parameter to the call (for all types other than strings)
7575
/// </summary>
76+
/// <param name="command">Command object</param>
7677
/// <param name="id">Name of the parameter</param>
78+
/// <param name="type">SQL type of the parameter</param>
7779
/// <param name="value">Value to add</param>
7880
/// <param name="direction">Direction that the parameter goes (in or out)</param>
79-
/// <param name="command">Command object</param>
80-
/// <param name="type">SQL type of the parameter</param>
8181
/// <returns>The DbCommand object</returns>
82+
/// <exception cref="ArgumentNullException">command or id</exception>
8283
public static DbCommand AddParameter(this DbCommand command, string id, SqlDbType type,
8384
object value = null, ParameterDirection direction = ParameterDirection.Input)
8485
{
@@ -93,11 +94,12 @@ public static DbCommand AddParameter(this DbCommand command, string id, SqlDbTyp
9394
/// Adds a parameter to the call (for all types other than strings)
9495
/// </summary>
9596
/// <typeparam name="DataType">Data type of the parameter</typeparam>
96-
/// <param name="id">Name of the parameter</param>
97-
/// <param name="direction">Direction that the parameter goes (in or out)</param>
9897
/// <param name="command">Command object</param>
98+
/// <param name="id">Name of the parameter</param>
9999
/// <param name="value">Value to add</param>
100+
/// <param name="direction">Direction that the parameter goes (in or out)</param>
100101
/// <returns>The DbCommand object</returns>
102+
/// <exception cref="ArgumentNullException">command or id</exception>
101103
public static DbCommand AddParameter<DataType>(this DbCommand command, string id, DataType value = default(DataType),
102104
ParameterDirection direction = ParameterDirection.Input)
103105
{
@@ -113,12 +115,13 @@ public static DbCommand AddParameter(this DbCommand command, string id, SqlDbTyp
113115
/// <summary>
114116
/// Adds a parameter to the call (for all types other than strings)
115117
/// </summary>
116-
/// <param name="id">Name of the parameter</param>
117-
/// <param name="direction">Direction that the parameter goes (in or out)</param>
118118
/// <param name="command">Command object</param>
119-
/// <param name="value">Value to add</param>
119+
/// <param name="id">Name of the parameter</param>
120120
/// <param name="type">SQL type of the parameter</param>
121+
/// <param name="value">Value to add</param>
122+
/// <param name="direction">Direction that the parameter goes (in or out)</param>
121123
/// <returns>The DbCommand object</returns>
124+
/// <exception cref="ArgumentNullException">command or id</exception>
122125
public static DbCommand AddParameter(this DbCommand command, string id, DbType type, object value = null,
123126
ParameterDirection direction = ParameterDirection.Input)
124127
{
@@ -157,8 +160,7 @@ public static DbTransaction BeginTransaction(this DbCommand command, int retries
157160
/// <returns>The DBCommand object</returns>
158161
public static DbCommand ClearParameters(this DbCommand command)
159162
{
160-
if (command?.Parameters != null)
161-
command.Parameters.Clear();
163+
command?.Parameters?.Clear();
162164
return command;
163165
}
164166

@@ -185,8 +187,7 @@ public static DbCommand Close(this DbCommand command)
185187
/// <returns>The DBCommand object</returns>
186188
public static DbCommand Commit(this DbCommand command)
187189
{
188-
if (command?.Transaction != null)
189-
command.Transaction.Commit();
190+
command?.Transaction?.Commit();
190191
return command;
191192
}
192193

@@ -226,8 +227,8 @@ public static DbCommand Commit(this DbCommand command)
226227
/// <summary>
227228
/// Gets a parameter or creates it, if it is not found
228229
/// </summary>
229-
/// <param name="id">Name of the parameter</param>
230230
/// <param name="command">Command object</param>
231+
/// <param name="id">Name of the parameter</param>
231232
/// <returns>The DbParameter associated with the ID</returns>
232233
public static DbParameter GetOrCreateParameter(this DbCommand command, string id)
233234
{
@@ -248,8 +249,8 @@ public static DbParameter GetOrCreateParameter(this DbCommand command, string id
248249
/// Returns an output parameter's value
249250
/// </summary>
250251
/// <typeparam name="DataType">Data type of the object</typeparam>
251-
/// <param name="id">Parameter name</param>
252252
/// <param name="command">Command object</param>
253+
/// <param name="id">Parameter name</param>
253254
/// <param name="defaultValue">Default value for the parameter</param>
254255
/// <returns>
255256
/// if the parameter exists (and isn't null or empty), it returns the parameter's value.
@@ -299,8 +300,7 @@ public static DbCommand Open(this DbCommand command, int retries = 0)
299300
/// <returns>The DBCommand object</returns>
300301
public static DbCommand Rollback(this DbCommand command)
301302
{
302-
if (command?.Transaction != null)
303-
command.Transaction.Rollback();
303+
command?.Transaction?.Rollback();
304304
return command;
305305
}
306306
}

src/SQLHelper.DB/HelperClasses/Command.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@ public class Command<TCallbackData> : ICommand
3535
/// <summary>
3636
/// Constructor
3737
/// </summary>
38+
/// <param name="callBack">Called when command has been executed</param>
39+
/// <param name="callbackObject">Object</param>
3840
/// <param name="sqlCommand">SQL Command</param>
3941
/// <param name="commandType">Command type</param>
4042
/// <param name="parameters">Parameters</param>
41-
/// <param name="callBack">Called when command has been executed</param>
42-
/// <param name="callbackObject">Object</param>
4343
public Command(Action<ICommand, List<dynamic>, TCallbackData> callBack, TCallbackData callbackObject, string sqlCommand, CommandType commandType, IParameter[] parameters)
4444
{
4545
SQLCommand = (sqlCommand ?? "");
4646
CommandType = commandType;
47-
CallBack = callBack ?? ((x, y, z) => { });
47+
CallBack = callBack ?? ((___, __, _) => { });
4848
Object = callbackObject;
4949
Parameters = parameters ?? new IParameter[0];
5050
var ComparisonString = SQLCommand.ToUpperInvariant();
@@ -54,19 +54,19 @@ public Command(Action<ICommand, List<dynamic>, TCallbackData> callBack, TCallbac
5454
/// <summary>
5555
/// Constructor
5656
/// </summary>
57+
/// <param name="callBack">Called when command has been executed</param>
58+
/// <param name="callbackObject">Object</param>
5759
/// <param name="sqlCommand">SQL Command</param>
5860
/// <param name="commandType">Command type</param>
59-
/// <param name="parameters">Parameters</param>
6061
/// <param name="parameterStarter">Parameter starter</param>
61-
/// <param name="callBack">Called when command has been executed</param>
62-
/// <param name="callbackObject">Object</param>
62+
/// <param name="parameters">Parameters</param>
6363
public Command(Action<ICommand, List<dynamic>, TCallbackData> callBack, TCallbackData callbackObject, string sqlCommand, CommandType commandType, string parameterStarter, object[] parameters)
6464
{
6565
SQLCommand = (sqlCommand ?? "");
6666
CommandType = commandType;
6767
parameters = parameters ?? new object[0];
6868
Parameters = new IParameter[parameters.Length];
69-
CallBack = callBack ?? ((x, y, z) => { });
69+
CallBack = callBack ?? ((___, __, _) => { });
7070
Object = callbackObject;
7171
var ComparisonString = SQLCommand.ToUpperInvariant();
7272
DetermineFinalizable(parameterStarter, ComparisonString);

src/SQLHelper.DB/SQLHelper.DB.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
</PropertyGroup>
2626

2727
<ItemGroup>
28-
<PackageReference Include="SQLParser" Version="2.0.5" />
28+
<PackageReference Include="SQLParser" Version="2.0.6" />
2929
<PackageReference Include="System.Data.Common" Version="4.3.0" />
30-
<PackageReference Include="System.Data.SqlClient" Version="4.5.1" />
30+
<PackageReference Include="System.Data.SqlClient" Version="4.6.0" />
3131
<PackageReference Include="System.Dynamic.Runtime" Version="4.3.0" />
32-
<PackageReference Include="BigBook" Version="2.1.4" />
33-
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1" />
32+
<PackageReference Include="BigBook" Version="2.1.7" />
33+
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
3434
<PackageReference Include="Microsoft.CSharp" Version="4.5.0" />
3535
</ItemGroup>
3636

src/SQLHelper.DB/SQLHelper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,19 @@ public SQLHelper(IConnection connection)
8181
/// <returns>This</returns>
8282
public SQLHelper AddQuery(string command, CommandType commandType, params IParameter[] parameters)
8383
{
84-
return AddQuery<object>((x, y, z) => { }, null, command, commandType, parameters);
84+
return AddQuery<object>((___, __, _) => { }, null, command, commandType, parameters);
8585
}
8686

8787
/// <summary>
8888
/// Adds a command.
8989
/// </summary>
90-
/// <param name="command">The command.</param>
9190
/// <param name="commandType">Type of the command.</param>
91+
/// <param name="command">The command.</param>
9292
/// <param name="parameters">The parameters.</param>
9393
/// <returns>This</returns>
9494
public SQLHelper AddQuery(CommandType commandType, string command, params object[] parameters)
9595
{
96-
return AddQuery<object>((x, y, z) => { }, null, commandType, command, parameters);
96+
return AddQuery<object>((___, __, _) => { }, null, commandType, command, parameters);
9797
}
9898

9999
/// <summary>

test/SQLHelper.Tests/HelperClasses/BatchTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public void AddQuery()
2020
"Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false",
2121
"DATABASE NAME")
2222
);
23-
Instance.AddQuery((x, y, z) => { }, 10, CommandType.Text, "SELECT * FROM TestUsers");
23+
Instance.AddQuery((___, __, _) => { }, 10, CommandType.Text, "SELECT * FROM TestUsers");
2424
Assert.NotNull(Instance);
2525
Assert.Equal("SELECT * FROM TestUsers", Instance.ToString());
2626
}
@@ -36,8 +36,8 @@ public void AddQuerys()
3636
"Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false",
3737
"DATABASE NAME")
3838
);
39-
Instance.AddQuery((x, y, z) => { }, 10, CommandType.Text, "SELECT * FROM TestUsers")
40-
.AddQuery((x, y, z) => { }, 10, CommandType.Text, "SELECT * FROM TestGroups");
39+
Instance.AddQuery((___, __, _) => { }, 10, CommandType.Text, "SELECT * FROM TestUsers")
40+
.AddQuery((___, __, _) => { }, 10, CommandType.Text, "SELECT * FROM TestGroups");
4141
Assert.NotNull(Instance);
4242
Assert.Equal("SELECT * FROM TestUsers\r\nSELECT * FROM TestGroups", Instance.ToString());
4343
}
@@ -53,8 +53,8 @@ public void AddQuerysWithParameters()
5353
"Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false",
5454
"DATABASE NAME")
5555
);
56-
Instance.AddQuery((x, y, z) => { }, 10, "SELECT * FROM TestUsers WHERE UserID=@0", CommandType.Text, 1)
57-
.AddQuery((x, y, z) => { }, 10, "SELECT * FROM TestGroups WHERE GroupID=@0", CommandType.Text, 10);
56+
Instance.AddQuery((___, __, _) => { }, 10, "SELECT * FROM TestUsers WHERE UserID=@0", CommandType.Text, 1)
57+
.AddQuery((___, __, _) => { }, 10, "SELECT * FROM TestGroups WHERE GroupID=@0", CommandType.Text, 10);
5858
Assert.NotNull(Instance);
5959
Assert.Equal("SELECT * FROM TestUsers WHERE UserID=1\r\nSELECT * FROM TestGroups WHERE GroupID=10", Instance.ToString());
6060
}
@@ -70,7 +70,7 @@ public void AddQueryWithParameters()
7070
"Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false",
7171
"DATABASE NAME")
7272
);
73-
Instance.AddQuery((x, y, z) => { }, 10, "SELECT * FROM TestUsers WHERE UserID=@0", CommandType.Text, 1);
73+
Instance.AddQuery((___, __, _) => { }, 10, "SELECT * FROM TestUsers WHERE UserID=@0", CommandType.Text, 1);
7474
Assert.NotNull(Instance);
7575
Assert.Equal("SELECT * FROM TestUsers WHERE UserID=1", Instance.ToString());
7676
}

0 commit comments

Comments
 (0)