Refaktorisierter EmailOutService zur Unterstützung generischer Lokalisierungsressourcen durch Hinzufügen eines generischen Parameters zur Klasse und Aktualisierung des Konstruktors.

This commit is contained in:
Developer 02
2024-05-22 09:49:02 +02:00
parent 02afdfbd0f
commit 1adc0c4d93
2 changed files with 6 additions and 6 deletions

View File

@@ -8,13 +8,13 @@ namespace DigitalData.EmailProfilerDispatcher.Application
{
public static class DIExtensions
{
public static IServiceCollection AddDispatcher<TDbContext>(this IServiceCollection services) where TDbContext : DbContext => services
public static IServiceCollection AddDispatcher<TDbContext, TResource>(this IServiceCollection services) where TDbContext : DbContext => services
.AddDispatcherRepository<TDbContext>()
.AddAutoMapper(typeof(MappingProfile).Assembly)
.AddScoped<IEmailOutService, EmailOutService>();
.AddScoped<IEmailOutService, EmailOutService<TResource>>();
public static IServiceCollection AddDispatcher(this IServiceCollection services, Action<DbContextOptionsBuilder> options) => services
public static IServiceCollection AddDispatcher<TResource>(this IServiceCollection services, Action<DbContextOptionsBuilder> options) => services
.AddDbContext<DefaultMailDbContext>(options)
.AddDispatcher<DefaultMailDbContext>();
.AddDispatcher<DefaultMailDbContext, TResource>();
}
}

View File

@@ -8,9 +8,9 @@ using Microsoft.Extensions.Localization;
namespace DigitalData.EmailProfilerDispatcher.Application.Services
{
public class EmailOutService : CRUDService<IEmailOutRepository, EmailOutCreateDto, EmailOutDto, EmailOutDto, EmailOut, int>, IEmailOutService
public class EmailOutService<TResource> : CRUDService<IEmailOutRepository, EmailOutCreateDto, EmailOutDto, EmailOutDto, EmailOut, int>, IEmailOutService
{
public EmailOutService(IEmailOutRepository repository, IStringLocalizer localizer, IMapper mapper) : base(repository, localizer, mapper)
public EmailOutService(IEmailOutRepository repository, IStringLocalizer<TResource> localizer, IMapper mapper) : base(repository, localizer, mapper)
{
}
}