Skip to content

Commit

Permalink
Minor software improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
engineering87 committed Oct 9, 2024
1 parent 5ceb79b commit 8348a77
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 50 deletions.
2 changes: 1 addition & 1 deletion src/OpenSharpTrace.TestApi/OpenSharpTrace.TestApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.1" />
</ItemGroup>

<ItemGroup>
Expand Down
41 changes: 0 additions & 41 deletions src/OpenSharpTrace/OpenSharpTrace - Backup.csproj

This file was deleted.

12 changes: 6 additions & 6 deletions src/OpenSharpTrace/OpenSharpTrace.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.10" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
7 changes: 6 additions & 1 deletion src/OpenSharpTrace/Persistence/SQL/SqlTraceRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class SqlTraceRepository : ISqlTraceRepository

public SqlTraceRepository(ILoggerFactory loggerFactory, TraceContext context)
{
_context = context;
_context = context ?? throw new ArgumentNullException(nameof(context));
_logger = loggerFactory.CreateLogger(GetType().ToString());
}

Expand All @@ -27,6 +27,11 @@ public SqlTraceRepository(ILoggerFactory loggerFactory, TraceContext context)
/// <param name="entities"></param>
public void InsertMany(List<Trace> entities)
{
if (entities == null || entities.Count == 0)
{
return;
}

try
{
var strategy = _context.Database.CreateExecutionStrategy();
Expand Down
6 changes: 5 additions & 1 deletion src/OpenSharpTrace/Persistence/SQL/TraceContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ private void EnsureTraceTableExists()
{
try
{
connection.Open();
if (connection.State != System.Data.ConnectionState.Open)
{
connection.Open();
}

using (var command = connection.CreateCommand())
{
command.CommandText = @"
Expand Down

0 comments on commit 8348a77

Please sign in to comment.