File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
OA.Infrastructure/Extension Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -36,10 +36,11 @@ public static void AddAutoMapper(this IServiceCollection serviceCollection)
3636 serviceCollection . AddSingleton ( mapper ) ;
3737 }
3838
39- public static void AddRepository ( this IServiceCollection serviceCollection )
39+ public static void AddAddScopedServices ( this IServiceCollection serviceCollection )
4040 {
4141 serviceCollection . AddScoped ( typeof ( IGenericRepository < > ) , typeof ( GenericRepository < > ) ) ;
4242 serviceCollection . AddScoped < ICustomerRepository , CustomerRepository > ( ) ;
43+ serviceCollection . AddScoped < IApplicationDbContext > ( provider => provider . GetService < ApplicationDbContext > ( ) ) ;
4344 }
4445
4546 public static void AddTransientServices ( this IServiceCollection serviceCollection )
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ public void ConfigureServices(IServiceCollection services)
3434
3535 services . AddAutoMapper ( ) ;
3636
37- services . AddRepository ( ) ;
37+ services . AddAddScopedServices ( ) ;
3838
3939 services . AddTransientServices ( ) ;
4040
@@ -44,7 +44,7 @@ public void ConfigureServices(IServiceCollection services)
4444
4545 services . AddApplication ( ) ;
4646
47- services . AddScoped < IApplicationDbContext > ( provider => provider . GetService < ApplicationDbContext > ( ) ) ;
47+
4848 }
4949
5050 public void Configure ( IApplicationBuilder app , IWebHostEnvironment env , ILoggerFactory loggerFactory )
You can’t perform that action at this time.
0 commit comments