50828d23ec
- 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.
27 lines
979 B
C#
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;
|
|
}
|
|
}
|