5cf5f888eb
- ServiceCollectionExtensions in DAL.EF: AddNotificationDataAccess (DbContext, UoW, repositories) - ServiceCollectionExtensions in Services: AddNotificationServices (MediatR + TransactionBehavior) - Api/Program.cs: Serilog, OpenAPI, controllers, DI wiring - Worker/Program.cs: Serilog, DI wiring - appsettings.json: Serilog config with Console + Seq sinks, connection string - appsettings.Development.json: Debug log level overrides Ref: IT-628 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
27 lines
987 B
C#
27 lines
987 B
C#
using HrynCo.NotificationService.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<IUnitOfWork, UnitOfWork>();
|
|
services.AddScoped<IEmailTemplateRepository, EmailTemplateRepository>();
|
|
services.AddScoped<IEmailChannelRepository, EmailChannelRepository>();
|
|
services.AddScoped<IEmailChannelUsageRepository, EmailChannelUsageRepository>();
|
|
|
|
return services;
|
|
}
|
|
}
|