Skip to content

Commit 0688b36

Browse files
committed
-Package updates.
1 parent 937bb67 commit 0688b36

File tree

15 files changed

+62
-75
lines changed

15 files changed

+62
-75
lines changed

SQLHelper.SpeedTests/SQLHelper.SpeedTests.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="BenchmarkDotNet" Version="0.12.1" />
11-
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="5.0.1" />
10+
<PackageReference Include="BenchmarkDotNet" Version="0.13.0" />
11+
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="5.0.7" />
1212
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
13-
<PackageReference Include="ZString" Version="2.2.0" />
13+
<PackageReference Include="ZString" Version="2.4.2" />
1414
</ItemGroup>
1515

1616
<ItemGroup>

SQLHelper.SpeedTests/Tests/AddQuery.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using BenchmarkDotNet.Attributes;
2-
using BigBook;
32
using Microsoft.Extensions.Configuration;
43
using Microsoft.Extensions.DependencyInjection;
54
using Microsoft.Extensions.ObjectPool;
@@ -23,7 +22,7 @@ public void Setup()
2322
{
2423
new ServiceCollection().AddCanisterModules(x => x.AddAssembly(typeof(Program).Assembly)
2524
.RegisterSQLHelper());
26-
Helper = new SQLHelper(Canister.Builder.Bootstrapper.Resolve<ObjectPool<StringBuilder>>(), Canister.Builder.Bootstrapper.Resolve<DynamoFactory>(), Canister.Builder.Bootstrapper.Resolve<IConfiguration>(), null);
25+
Helper = new SQLHelper(Canister.Builder.Bootstrapper.Resolve<ObjectPool<StringBuilder>>(), Canister.Builder.Bootstrapper.Resolve<IConfiguration>(), null);
2726
}
2827
}
2928
}

SQLHelper.SpeedTests/Tests/AltImplementations/HelperClasses/BaseClasses/ParameterBase.cs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ limitations under the License.
1616

1717
using BigBook;
1818
using BigBook.Comparison;
19+
using ObjectCartographer;
1920
using SQLHelperDBTests.HelperClasses.Interfaces;
2021
using System;
2122
using System.Collections.Generic;

SQLHelper.SpeedTests/Tests/AltImplementations/SQLHelper.cs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ limitations under the License.
1616

1717
using BigBook;
1818
using Microsoft.Extensions.Configuration;
19+
using ObjectCartographer;
1920
using SQLHelperDBTests.HelperClasses;
2021
using SQLHelperDBTests.HelperClasses.Interfaces;
2122
using System;

SQLHelper.SpeedTests/Tests/MassInsert.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using BenchmarkDotNet.Attributes;
2-
using BigBook;
32
using Microsoft.Extensions.Configuration;
43
using Microsoft.Extensions.DependencyInjection;
54
using Microsoft.Extensions.ObjectPool;
@@ -111,7 +110,7 @@ public void Setup()
111110
{
112111
new ServiceCollection().AddCanisterModules(x => x.AddAssembly(typeof(Program).Assembly)
113112
.RegisterSQLHelper());
114-
Helper = new SQLHelper(Canister.Builder.Bootstrapper.Resolve<ObjectPool<StringBuilder>>(), Canister.Builder.Bootstrapper.Resolve<DynamoFactory>(), Canister.Builder.Bootstrapper.Resolve<IConfiguration>(), null);
113+
Helper = new SQLHelper(Canister.Builder.Bootstrapper.Resolve<ObjectPool<StringBuilder>>(), Canister.Builder.Bootstrapper.Resolve<IConfiguration>(), null);
115114
Helper2 = new SQLHelperDBTests.SQLHelper(Canister.Builder.Bootstrapper.Resolve<IConfiguration>(), SqlClientFactory.Instance);
116115

117116
using (var TempConnection = SqlClientFactory.Instance.CreateConnection())

src/SQLHelper.DB/ExtensionMethods/DbCommandExtensions.cs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ limitations under the License.
1616

1717
using BigBook;
1818
using BigBook.Comparison;
19+
using ObjectCartographer;
1920
using System;
2021
using System.Data;
2122
using System.Data.Common;

src/SQLHelper.DB/ExtensionMethods/IDataRecordExtensions.cs

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ limitations under the License.
1515
*/
1616

1717
using BigBook;
18+
using ObjectCartographer;
1819
using System;
1920
using System.Data;
2021

src/SQLHelper.DB/HelperClasses/BaseClasses/ParameterBase.cs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ limitations under the License.
1616

1717
using BigBook;
1818
using BigBook.Comparison;
19+
using ObjectCartographer;
1920
using SQLHelperDB.HelperClasses.Interfaces;
2021
using System;
2122
using System.Collections.Generic;

src/SQLHelper.DB/HelperClasses/Batch.cs

+7-15
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,25 @@ public class Batch : IBatch
4343
/// </summary>
4444
/// <param name="source">Source info</param>
4545
/// <param name="stringBuilderPool">The string builder pool.</param>
46-
/// <param name="dynamoFactory">The dynamo factory.</param>
4746
/// <param name="logger">The logger.</param>
48-
public Batch(IConnection source, ObjectPool<StringBuilder> stringBuilderPool, DynamoFactory dynamoFactory, ILogger? logger)
47+
public Batch(IConnection source, ObjectPool<StringBuilder> stringBuilderPool, ILogger? logger)
4948
{
5049
Commands = new List<ICommand>();
5150
Headers = new List<ICommand>();
5251
Source = source;
5352
StringBuilderPool = stringBuilderPool;
54-
DynamoFactory = dynamoFactory;
5553
Logger = logger;
5654
}
5755

5856
/// <summary>
59-
/// Command count
57+
/// Used to parse SQL commands to find parameters (when batching)
6058
/// </summary>
61-
public int CommandCount => Commands.Count;
59+
private static readonly Regex ParameterRegex = new Regex(@"[^@](?<ParamStart>[:@?])(?<ParamName>\w+)", RegexOptions.Compiled);
6260

6361
/// <summary>
64-
/// Gets the dynamo factory.
62+
/// Command count
6563
/// </summary>
66-
/// <value>The dynamo factory.</value>
67-
public DynamoFactory DynamoFactory { get; }
64+
public int CommandCount => Commands.Count;
6865

6966
/// <summary>
7067
/// Gets the string builder pool.
@@ -94,11 +91,6 @@ public Batch(IConnection source, ObjectPool<StringBuilder> stringBuilderPool, Dy
9491
/// <value>The logger.</value>
9592
private ILogger? Logger { get; }
9693

97-
/// <summary>
98-
/// Used to parse SQL commands to find parameters (when batching)
99-
/// </summary>
100-
private static readonly Regex ParameterRegex = new Regex(@"[^@](?<ParamStart>[:@?])(?<ParamName>\w+)", RegexOptions.Compiled);
101-
10294
/// <summary>
10395
/// Adds a command to be batched
10496
/// </summary>
@@ -283,7 +275,7 @@ private async Task GetResultsAsync(List<List<dynamic>> ReturnValue, DbCommand Ex
283275
}
284276
else
285277
{
286-
ReturnValue.Add(new List<dynamic> { DynamoFactory.Create(await ExecutableCommand.ExecuteNonQueryAsync().ConfigureAwait(false), false) });
278+
ReturnValue.Add(new List<dynamic> { new Dynamo(await ExecutableCommand.ExecuteNonQueryAsync().ConfigureAwait(false), false) });
287279
}
288280
}
289281

@@ -305,7 +297,7 @@ private List<dynamic> GetValues(DbDataReader tempReader)
305297
}
306298
while (tempReader.Read())
307299
{
308-
var Value = DynamoFactory.Create(false);
300+
var Value = new Dynamo(false);
309301
for (var x = 0; x < tempReader.FieldCount; ++x)
310302
{
311303
Value.Add(FieldNames[x], tempReader[x]);

src/SQLHelper.DB/SQLHelper.DB.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@
3535
<PrivateAssets>all</PrivateAssets>
3636
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3737
</PackageReference>
38-
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="5.0.1" />
39-
<PackageReference Include="SQLParser" Version="2.0.13" />
38+
<PackageReference Include="Microsoft.Extensions.ObjectPool" Version="5.0.7" />
39+
<PackageReference Include="SQLParser" Version="2.0.14" />
4040
<PackageReference Include="System.Data.Common" Version="4.3.0" />
4141
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
4242
<PackageReference Include="System.Dynamic.Runtime" Version="4.3.0" />
43-
<PackageReference Include="BigBook" Version="3.0.56" />
43+
<PackageReference Include="BigBook" Version="4.0.5" />
4444
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
4545
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
4646
</ItemGroup>

src/SQLHelper.DB/SQLHelper.cs

+3-10
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ limitations under the License.
1818
using Microsoft.Extensions.Configuration;
1919
using Microsoft.Extensions.Logging;
2020
using Microsoft.Extensions.ObjectPool;
21+
using ObjectCartographer;
2122
using SQLHelperDB.HelperClasses;
2223
using SQLHelperDB.HelperClasses.Interfaces;
2324
using System;
@@ -41,13 +42,11 @@ public class SQLHelper
4142
/// Initializes a new instance of the <see cref="SQLHelper"/> class.
4243
/// </summary>
4344
/// <param name="stringBuilderPool">The string builder pool.</param>
44-
/// <param name="dynamoFactory">The dynamo factory.</param>
4545
/// <param name="configuration">The configuration.</param>
4646
/// <param name="logger">The logger.</param>
47-
public SQLHelper(ObjectPool<StringBuilder> stringBuilderPool, DynamoFactory dynamoFactory, IConfiguration configuration, ILogger<SQLHelper>? logger)
47+
public SQLHelper(ObjectPool<StringBuilder> stringBuilderPool, IConfiguration configuration, ILogger<SQLHelper>? logger)
4848
{
4949
StringBuilderPool = stringBuilderPool;
50-
DynamoFactory = dynamoFactory;
5150
Configuration = configuration;
5251
SetConnection(new Connection(configuration, SqlClientFactory.Instance, "Default"));
5352
Logger = logger;
@@ -77,12 +76,6 @@ public SQLHelper(ObjectPool<StringBuilder> stringBuilderPool, DynamoFactory dyna
7776
/// <value>The configuration.</value>
7877
protected IConfiguration Configuration { get; }
7978

80-
/// <summary>
81-
/// Gets the dynamo factory.
82-
/// </summary>
83-
/// <value>The dynamo factory.</value>
84-
protected DynamoFactory DynamoFactory { get; }
85-
8679
/// <summary>
8780
/// Gets the string builder pool.
8881
/// </summary>
@@ -250,7 +243,7 @@ private void SetConnection(IConnection connection)
250243
DatabaseConnection = connection ?? throw new ArgumentNullException(nameof(connection));
251244
if (!Connections.ContainsKey(connection.Name))
252245
Connections.AddOrUpdate(connection.Name, connection, (_, value) => value);
253-
Batch ??= new Batch(DatabaseConnection, StringBuilderPool, DynamoFactory, Logger);
246+
Batch ??= new Batch(DatabaseConnection, StringBuilderPool, Logger);
254247
Batch.SetConnection(DatabaseConnection);
255248
}
256249
}

test/SQLHelper.Tests/HelperClasses/BatchTests.cs

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using BigBook;
2-
using Microsoft.Extensions.Configuration;
1+
using Microsoft.Extensions.Configuration;
32
using Microsoft.Extensions.ObjectPool;
43
using SQLHelperDB.HelperClasses;
54
using SQLHelperDB.Tests.BaseClasses;
@@ -23,7 +22,7 @@ public void AddQuery()
2322
"Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false",
2423
"DATABASE NAME"),
2524
Canister.Builder.Bootstrapper.Resolve<ObjectPool<StringBuilder>>(),
26-
Canister.Builder.Bootstrapper.Resolve<DynamoFactory>(), null
25+
null
2726
);
2827
Instance.AddQuery((___, __, _) => { }, 10, false, "SELECT * FROM TestUsers", CommandType.Text);
2928
Assert.NotNull(Instance);
@@ -41,7 +40,7 @@ public void AddQuerys()
4140
"Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false",
4241
"DATABASE NAME"),
4342
Canister.Builder.Bootstrapper.Resolve<ObjectPool<StringBuilder>>(),
44-
Canister.Builder.Bootstrapper.Resolve<DynamoFactory>(), null
43+
null
4544
);
4645
Instance.AddQuery((___, __, _) => { }, 10, false, "SELECT * FROM TestUsers", CommandType.Text)
4746
.AddQuery((___, __, _) => { }, 10, false, "SELECT * FROM TestGroups", CommandType.Text);
@@ -60,7 +59,7 @@ public void AddQuerysWithParameters()
6059
"Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false",
6160
"DATABASE NAME"),
6261
Canister.Builder.Bootstrapper.Resolve<ObjectPool<StringBuilder>>(),
63-
Canister.Builder.Bootstrapper.Resolve<DynamoFactory>(), null
62+
null
6463
);
6564
Instance.AddQuery((___, __, _) => { }, 10, false, "SELECT * FROM TestUsers WHERE UserID=@0", CommandType.Text, 1)
6665
.AddQuery((___, __, _) => { }, 10, false, "SELECT * FROM TestGroups WHERE GroupID=@0", CommandType.Text, 10);
@@ -79,7 +78,7 @@ public void AddQueryWithParameters()
7978
"Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false",
8079
"DATABASE NAME"),
8180
Canister.Builder.Bootstrapper.Resolve<ObjectPool<StringBuilder>>(),
82-
Canister.Builder.Bootstrapper.Resolve<DynamoFactory>(), null
81+
null
8382
);
8483
Instance.AddQuery((___, __, _) => { }, 10, false, "SELECT * FROM TestUsers WHERE UserID=@0", CommandType.Text, 1);
8584
Assert.NotNull(Instance);
@@ -97,7 +96,7 @@ public void Creation()
9796
"Data Source=localhost;Initial Catalog=TestDatabase;Integrated Security=SSPI;Pooling=false",
9897
"DATABASE NAME"),
9998
Canister.Builder.Bootstrapper.Resolve<ObjectPool<StringBuilder>>(),
100-
Canister.Builder.Bootstrapper.Resolve<DynamoFactory>(), null
99+
null
101100
);
102101
Assert.NotNull(Instance);
103102
Assert.Equal("", Instance.ToString());

test/SQLHelper.Tests/SQLHelper.Tests.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
</ItemGroup>
2828

2929
<ItemGroup>
30-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
30+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.10.0" />
3131
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
3232
<PrivateAssets>all</PrivateAssets>
3333
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
3434
</PackageReference>
3535
<PackageReference Include="xunit" Version="2.4.1" />
36-
<PackageReference Include="FileCurator" Version="3.1.25" />
36+
<PackageReference Include="FileCurator" Version="3.1.33" />
3737
</ItemGroup>
3838

3939
<ItemGroup>

0 commit comments

Comments
 (0)