Files
EmailProfilerDispatcher/DigitalData.EmailProfilerDispatcher.Application/DIExtensions.cs

21 lines
953 B
C#

using DigitalData.EmailProfilerDispatcher.Application.Contracts;
using DigitalData.EmailProfilerDispatcher.Application.Services;
using DigitalData.EmailProfilerDispatcher.Infrastructure;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
namespace DigitalData.EmailProfilerDispatcher.Application
{
public static class DIExtensions
{
public static IServiceCollection AddDispatcher<TDbContext>(this IServiceCollection services) where TDbContext : DbContext => services
.AddDispatcherRepository<TDbContext>()
.AddAutoMapper(typeof(MappingProfile).Assembly)
.AddScoped<IEmailOutService, EmailOutService>();
public static IServiceCollection AddDispatcher(this IServiceCollection services, Action<DbContextOptionsBuilder> options) => services
.AddDbContext<DefaultMailDbContext>(options)
.AddDispatcher<DefaultMailDbContext>();
}
}