Files
hrynco-notification-service/HrynCo.NotificationService.DAL.EF/ServiceCollectionExtensions.cs
T
Anatolii Grynchuk 50828d23ec refactor: replace internal UnitOfWork with NotificationUnitOfWork and NotificationBaseRepository
- Consolidate unit of work implementation with NotificationUnitOfWork.
- Refactor repositories to use NotificationBaseRepository for consistency.
- Simplify request handlers by removing IUnitOfWork dependency.
- Update related tests and service registration.
2026-05-13 02:08:43 +03:00

27 lines
979 B
C#

using HrynCo.DAL.Abstract;
using HrynCo.NotificationService.DAL.Abstract.Repositories;
using HrynCo.NotificationService.DAL.EF.Core;
using HrynCo.NotificationService.DAL.EF.Repositories;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
namespace HrynCo.NotificationService.DAL.EF;
public static class ServiceCollectionExtensions
{
public static IServiceCollection AddNotificationDataAccess(
this IServiceCollection services,
string connectionString)
{
services.AddDbContext<NotificationDbContext>(options =>
options.UseNpgsql(connectionString));
services.AddScoped<IEmailTemplateRepository, EmailTemplateRepository>();
services.AddScoped<IEmailChannelRepository, EmailChannelRepository>();
services.AddScoped<IEmailChannelUsageRepository, EmailChannelUsageRepository>();
services.AddScoped<IUnitOfWork, NotificationUnitOfWork>();
return services;
}
}