Skip to content

Commit 66c3f23

Browse files
Updated parameters to allow for 'null' (default value).
1 parent 7422933 commit 66c3f23

4 files changed

Lines changed: 16 additions & 10 deletions

File tree

Source/Core/Extensions/Command.AddParameter.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ public static IDbDataParameter AddParameter(
2525

2626
var c = target.CreateParameter();
2727
c.ParameterName = name;
28-
if (value != null) // DBNull.Value is allowed.
29-
c.Value = value;
28+
c.Value = value;
3029
target.Parameters.Add(c);
3130
return c;
3231
}
@@ -43,7 +42,7 @@ public static IDbDataParameter AddParameter(
4342
public static IDbDataParameter AddParameter(
4443
this IDbCommand target,
4544
string name,
46-
object value,
45+
object? value,
4746
DbType type,
4847
ParameterDirection direction = ParameterDirection.Input)
4948
{

Source/Core/Open.Database.Extensions.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<PackageTags>ado;ado extensions;sql;connection factory;extensions;</PackageTags>
1515
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1616
<RepositoryType>git</RepositoryType>
17-
<Version>7.0.1</Version>
17+
<Version>7.0.2</Version>
1818
<PackageReleaseNotes></PackageReleaseNotes>
1919
<PublishRepositoryUrl>true</PublishRepositoryUrl>
2020
<IncludeSymbols>true</IncludeSymbols>

Source/SqlClient/Extensions/Command.AddParameter.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ public static partial class SqlCommandExtensions
2121
/// <param name="type">The DbType of the parameter.</param>
2222
/// <param name="direction">The direction of the parameter.</param>
2323
/// <returns>The created IDbDataParameter.</returns>
24-
public static SqlParameter AddParameter(this SqlCommand target,
25-
string name, object value, SqlDbType type, ParameterDirection direction = ParameterDirection.Input)
24+
public static SqlParameter AddParameter(
25+
this SqlCommand target,
26+
string name,
27+
object? value,
28+
SqlDbType type,
29+
ParameterDirection direction = ParameterDirection.Input)
2630
{
2731
if (target is null) throw new ArgumentNullException(nameof(target));
2832
Contract.EndContractBlock();
@@ -40,8 +44,11 @@ public static SqlParameter AddParameter(this SqlCommand target,
4044
/// <param name="type">The SqlDbType of the parameter.</param>
4145
/// <param name="direction">The direction of the parameter.</param>
4246
/// <returns>The created IDbDataParameter.</returns>
43-
public static SqlParameter AddParameterType(this SqlCommand target,
44-
string? name, SqlDbType type, ParameterDirection direction = ParameterDirection.Input)
47+
public static SqlParameter AddParameterType(
48+
this SqlCommand target,
49+
string? name,
50+
SqlDbType type,
51+
ParameterDirection direction = ParameterDirection.Input)
4552
{
4653
if (target is null) throw new ArgumentNullException(nameof(target));
4754
if (direction != ParameterDirection.ReturnValue && name == null)

Source/SqlClient/Open.Database.Extensions.SqlClient.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<PackageTags>ado;ado extensions;sql;connection factory;extensions;</PackageTags>
1515
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
1616
<RepositoryType>git</RepositoryType>
17-
<Version>7.0.1</Version>
17+
<Version>7.0.2</Version>
1818
<PackageReleaseNotes></PackageReleaseNotes>
1919
<PublishRepositoryUrl>true</PublishRepositoryUrl>
2020
<IncludeSymbols>true</IncludeSymbols>
@@ -28,7 +28,7 @@
2828

2929
<ItemGroup>
3030
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
31-
<PackageReference Include="Open.Database.Extensions.Core" Version="7.0.1" />
31+
<PackageReference Include="Open.Database.Extensions.Core" Version="7.0.2" />
3232
<PackageReference Include="System.Data.SqlClient" Version="4.*" />
3333
</ItemGroup>
3434

0 commit comments

Comments
 (0)