File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
src/LinkDotNet.Blog.Web/RegistrationExtensions Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -12,14 +12,13 @@ public static void UseSqlAsStorageProvider(this IServiceCollection services)
12
12
{
13
13
services . AssertNotAlreadyRegistered ( typeof ( IRepository < > ) ) ;
14
14
15
- services . AddDbContextFactory < BlogDbContext > (
15
+ services . AddPooledDbContextFactory < BlogDbContext > (
16
16
( s , builder ) =>
17
17
{
18
18
var configuration = s . GetRequiredService < AppConfiguration > ( ) ;
19
19
var connectionString = configuration . ConnectionString ;
20
20
builder . UseSqlServer ( connectionString ) ;
21
- } ,
22
- ServiceLifetime . Transient ) ;
21
+ } ) ;
23
22
24
23
services . AddScoped ( typeof ( IRepository < > ) , typeof ( Repository < > ) ) ;
25
24
}
@@ -28,14 +27,13 @@ public static void UseSqliteAsStorageProvider(this IServiceCollection services)
28
27
{
29
28
services . AssertNotAlreadyRegistered ( typeof ( IRepository < > ) ) ;
30
29
31
- services . AddDbContextFactory < BlogDbContext > (
30
+ services . AddPooledDbContextFactory < BlogDbContext > (
32
31
( s , builder ) =>
33
32
{
34
33
var configuration = s . GetRequiredService < AppConfiguration > ( ) ;
35
34
var connectionString = configuration . ConnectionString ;
36
35
builder . UseSqlite ( connectionString ) ;
37
- } ,
38
- ServiceLifetime . Transient ) ;
36
+ } ) ;
39
37
services . AddScoped ( typeof ( IRepository < > ) , typeof ( Repository < > ) ) ;
40
38
}
41
39
}
You can’t perform that action at this time.
0 commit comments