using HrynCo.Common; using HrynCo.NotificationService.Services.Behaviors; using HrynCo.NotificationService.Services.Logging; using MediatR; using Microsoft.Extensions.DependencyInjection; using Serilog; namespace HrynCo.NotificationService.Services; public static class ServiceCollectionExtensions { public static IServiceCollection AddNotificationServices(this IServiceCollection services) { services.AddMediatR(cfg => { cfg.RegisterServicesFromAssembly(typeof(ServiceCollectionExtensions).Assembly); cfg.AddBehavior(typeof(IPipelineBehavior<,>), typeof(TransactionBehavior<,>)); }); services.AddTransient(typeof(IContextualSerilogLogger<>), typeof(ContextualSerilogLogger<>)); services.AddSingleton(new Profiler(Log.Logger)); return services; } }