@@ -37,59 +37,38 @@ public UnitOfWorkBuilder(
37
37
public IUnitOfWorkBuilder < TDbContext > ConfigureDbContextPool ( Action < DbContextOptionsBuilder > configurer )
38
38
{
39
39
ArgumentNullException . ThrowIfNull ( configurer ) ;
40
-
41
- Services . AddDbContextPool < TDbContext > ( builder =>
42
- {
43
- builder . UseUnitOfWork ( ) ;
44
- configurer ( builder ) ;
45
- } ) ;
40
+ Services . AddDbContextPool < TDbContext > ( configurer ) ;
46
41
return this ;
47
42
}
48
43
49
44
/// <inheritdoc />
50
45
public IUnitOfWorkBuilder < TDbContext > ConfigureDbContextPool ( Action < IServiceProvider , DbContextOptionsBuilder > configurer )
51
46
{
52
47
ArgumentNullException . ThrowIfNull ( configurer ) ;
53
-
54
- Services . AddDbContextPool < TDbContext > ( ( sp , builder ) =>
55
- {
56
- builder . UseUnitOfWork ( ) ;
57
- configurer ( sp , builder ) ;
58
- } ) ;
48
+ Services . AddDbContextPool < TDbContext > ( configurer ) ;
59
49
return this ;
60
50
}
61
51
62
52
/// <inheritdoc />
63
53
public IUnitOfWorkBuilder < TDbContext > ConfigureDbContext ( Action < DbContextOptionsBuilder > configurer )
64
54
{
65
55
ArgumentNullException . ThrowIfNull ( configurer ) ;
66
-
67
- Services . AddDbContext < TDbContext > ( builder =>
68
- {
69
- builder . UseUnitOfWork ( ) ;
70
- configurer ( builder ) ;
71
- } , Lifetime ) ;
56
+ Services . AddDbContext < TDbContext > ( configurer , Lifetime ) ;
72
57
return this ;
73
58
}
74
59
75
60
/// <inheritdoc />
76
61
public IUnitOfWorkBuilder < TDbContext > ConfigureDbContext ( Action < IServiceProvider , DbContextOptionsBuilder > configurer )
77
62
{
78
63
ArgumentNullException . ThrowIfNull ( configurer ) ;
79
-
80
- Services . AddDbContext < TDbContext > ( ( sp , builder ) =>
81
- {
82
- builder . UseUnitOfWork ( ) ;
83
- configurer ( sp , builder ) ;
84
- } , Lifetime ) ;
64
+ Services . AddDbContext < TDbContext > ( configurer , Lifetime ) ;
85
65
return this ;
86
66
}
87
67
88
68
/// <inheritdoc />
89
69
public IUnitOfWorkBuilder < TDbContext > ConfigureRepositories ( Action < IRepositoriesBuilder < TDbContext > > configureAction )
90
70
{
91
71
ArgumentNullException . ThrowIfNull ( configureAction ) ;
92
-
93
72
var repositoryConfigurer = new RepositoriesBuilder < TDbContext > ( Services , Lifetime ) ;
94
73
configureAction ( repositoryConfigurer ) ;
95
74
return this ;
0 commit comments