File tree Expand file tree Collapse file tree 2 files changed +21
-6
lines changed
Infrastructure/Extensions Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change 1+ using Microsoft . Extensions . DependencyInjection ;
2+ using PaymentCoreServiceApi . Core . Interfaces . Repositories . Write ;
3+ using PaymentCoreServiceApi . Infrastructure . Repositories . Write ;
4+
5+ namespace PaymentCoreServiceApi . Infrastructure . Extensions ;
6+
7+ public static class ServiceCollectionExtensions
8+ {
9+ public static IServiceCollection AddRepositories ( this IServiceCollection services )
10+ {
11+ // Register Base Repositories
12+ services . AddScoped ( typeof ( IBaseWriteOnlyRepository < > ) , typeof ( EfBaseWriteOnlyRepository < > ) ) ;
13+
14+ // Register Domain Specific Repositories
15+ services . AddScoped < IUserWriteRepository , UserWriteRepository > ( ) ;
16+
17+ return services ;
18+ }
19+ }
Original file line number Diff line number Diff line change 11using System . Reflection ;
22using Microsoft . EntityFrameworkCore ;
33using PaymentCoreServiceApi . Infrastructure . DbContexts ;
4- using PaymentCoreServiceApi . Core . Interfaces . Repositories . Write ;
5- using PaymentCoreServiceApi . Core . Interfaces . Repositories . IUnitOfWork ;
6- using PaymentCoreServiceApi . Infrastructure . Repositories . Write ;
7- using PaymentCoreServiceApi . Infrastructure . Repositories . UnitOfWork ;
4+ using PaymentCoreServiceApi . Infrastructure . Extensions ;
85using MediatR ;
96
107var builder = WebApplication . CreateBuilder ( args ) ;
2118builder . Services . AddMediatR ( Assembly . GetExecutingAssembly ( ) ) ;
2219
2320// Register Repositories
24- builder . Services . AddScoped ( typeof ( IBaseWriteOnlyRepository < > ) , typeof ( EfBaseWriteOnlyRepository < > ) ) ;
25- builder . Services . AddScoped < IUserWriteRepository , UserWriteRepository > ( ) ;
21+ builder . Services . AddRepositories ( ) ;
2622
2723var app = builder . Build ( ) ;
2824
You can’t perform that action at this time.
0 commit comments