Refactor DI: move repository registrations to Infrastructure
Centralize repository service registrations in Infrastructure's DependencyInjection.cs for better maintainability and separation of concerns. Remove direct registrations from Program.cs and add necessary using statements.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
using DbFirst.Application.Repositories;
|
||||
using DbFirst.Infrastructure.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@@ -15,6 +17,10 @@ public static class DependencyInjection
|
||||
services.AddDbContext<MassDataDbContext>(options =>
|
||||
options.UseSqlServer(configuration.GetConnectionString("MassDataConnection")));
|
||||
|
||||
services.AddScoped<ICatalogRepository, CatalogRepository>();
|
||||
services.AddScoped<IMassDataRepository, MassDataRepository>();
|
||||
services.AddScoped<ILayoutRepository, LayoutRepository>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user