Skip to content

Commit 90a6b65

Browse files
(GH-669) Update sqlsever package to latest
1 parent 9111826 commit 90a6b65

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

benchmarks/DotNetToolkit.Repository.Performance/Benchmarks/BenchmarkBase.cs

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,31 @@
33
using System;
44
using System.Collections.Generic;
55
using System.Configuration;
6-
7-
#if NETFULL
8-
using System.Data.SqlClient;
9-
#endif
106
using BenchmarkDotNet.Attributes;
117
using Configuration.Options;
128
using Data;
9+
using InMemory;
1310
#if NETFULL
11+
using System.Data.SqlClient;
1412
using EntityFramework;
15-
#endif
13+
#else
14+
using AzureStorageBlob;
1615
using EntityFrameworkCore;
17-
using InMemory;
1816
using Microsoft.EntityFrameworkCore;
19-
#if NETCORE
20-
using AzureStorageBlob;
2117
#endif
2218

2319
public abstract class BenchmarkBase
2420
{
2521
#if NETFULL
2622
private SqlConnection _connection;
2723
#endif
28-
public static string ConnectionString { get; } = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
24+
public static string ConnectionString { get; } = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
2925

3026
protected void BaseSetup()
3127
{
3228
#if NETFULL
3329
_connection = new SqlConnection(ConnectionString);
34-
_connection.Open();
30+
_connection.Open();
3531
#endif
3632
}
3733

@@ -46,19 +42,18 @@ protected IRepositoryOptions BuildOptions(ContextProviderType provider)
4642
builder.UseInMemoryDatabase(Guid.NewGuid().ToString());
4743
break;
4844
}
49-
case ContextProviderType.EntityFrameworkCore:
50-
{
51-
builder.UseEntityFrameworkCore<EfCoreDbContext>(x => x.UseSqlServer(ConnectionString));
52-
break;
53-
}
5445
#if NETFULL
5546
case ContextProviderType.EntityFramework:
5647
{
5748
builder.UseEntityFramework<EfDbContext>(_connection);
5849
break;
5950
}
60-
#endif
61-
#if NETCORE
51+
#else
52+
case ContextProviderType.EntityFrameworkCore:
53+
{
54+
builder.UseEntityFrameworkCore<EfCoreDbContext>(x => x.UseSqlServer(ConnectionString));
55+
break;
56+
}
6257
case ContextProviderType.AzureStorageBlob:
6358
{
6459
builder.UseAzureStorageBlob(
@@ -67,7 +62,7 @@ protected IRepositoryOptions BuildOptions(ContextProviderType provider)
6762
break;
6863
}
6964
#endif
70-
default:
65+
default:
7166
throw new ArgumentOutOfRangeException(nameof(provider));
7267
}
7368

@@ -78,12 +73,11 @@ public virtual IEnumerable<ContextProviderType> Providers()
7873
{
7974
return new[]
8075
{
76+
ContextProviderType.InMemory,
8177
#if NETFULL
8278
ContextProviderType.EntityFramework,
83-
#endif
84-
ContextProviderType.InMemory,
79+
#else
8580
ContextProviderType.EntityFrameworkCore,
86-
#if NETCORE
8781
ContextProviderType.AzureStorageBlob,
8882
#endif
8983
};

benchmarks/DotNetToolkit.Repository.Performance/Data/EfCoreDbContext.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ public class EfCoreDbContext : DbContext
66
{
77
public DbSet<Customer> Customers { get; set; }
88

9-
public EfCoreDbContext(DbContextOptions options) : base(options) { }
9+
public EfCoreDbContext(DbContextOptions options) : base(options)
10+
{
11+
Database.EnsureCreated();
12+
}
1013
}
1114
}

benchmarks/DotNetToolkit.Repository.Performance/DotNetToolkit.Repository.Performance.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,16 @@
3232

3333
<ItemGroup>
3434
<PackageReference Include="BenchmarkDotNet" Version="0.13.0" />
35-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.2" />
3635
</ItemGroup>
3736

3837
<ItemGroup Condition="'$(TargetFramework)' == 'net461'">
3938
<PackageReference Include="EntityFramework.SqlServerCompact" Version="6.4.4" />
4039
<Reference Include="System.Configuration" />
4140
</ItemGroup>
41+
42+
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
43+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.11" />
44+
</ItemGroup>
4245

4346
<ItemGroup>
4447
<ProjectReference Include="..\..\src\DotNetToolkit.Repository.EntityFrameworkCore\DotNetToolkit.Repository.EntityFrameworkCore.csproj" />

0 commit comments

Comments
 (0)