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 } ;
0 commit comments