81654c0d33
Add normalized service and template catalogs, scoped administration, migration, validation, and regression coverage. Ref: IT-1601
30 lines
1.2 KiB
C#
30 lines
1.2 KiB
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<TemplateMutationRunner>();
|
|
services.AddScoped<INotificationServiceRepository, NotificationServiceRepository>();
|
|
services.AddScoped<IEmailTemplateRepository, EmailTemplateRepository>();
|
|
services.AddScoped<IEmailTemplateDefinitionRepository, EmailTemplateRepository>();
|
|
services.AddScoped<IEmailChannelRepository, EmailChannelRepository>();
|
|
services.AddScoped<IEmailChannelUsageRepository, EmailChannelUsageRepository>();
|
|
services.AddScoped<IUnitOfWork, NotificationUnitOfWork>();
|
|
|
|
return services;
|
|
}
|
|
}
|