Aktualisierte Vererbung von CRUD Service.

This commit is contained in:
Developer 02
2024-06-14 14:29:22 +02:00
parent aba93f1dd4
commit 76b4aafe0c
2 changed files with 5 additions and 8 deletions

View File

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

View File

@@ -3,17 +3,14 @@ using DigitalData.Core.Application;
using DigitalData.Core.DTO; using DigitalData.Core.DTO;
using DigitalData.EmailProfilerDispatcher.Application.Contracts; using DigitalData.EmailProfilerDispatcher.Application.Contracts;
using DigitalData.EmailProfilerDispatcher.Application.DTOs.EmailOut; using DigitalData.EmailProfilerDispatcher.Application.DTOs.EmailOut;
using DigitalData.EmailProfilerDispatcher.Domain.Attributes;
using DigitalData.EmailProfilerDispatcher.Domain.Entities; using DigitalData.EmailProfilerDispatcher.Domain.Entities;
using DigitalData.EmailProfilerDispatcher.Infrastructure.Contracts; using DigitalData.EmailProfilerDispatcher.Infrastructure.Contracts;
using Microsoft.Extensions.Localization;
using System.Reflection;
namespace DigitalData.EmailProfilerDispatcher.Application.Services namespace DigitalData.EmailProfilerDispatcher.Application.Services
{ {
public class EmailOutService<TResource> : CRUDService<IEmailOutRepository, EmailOutCreateDto, EmailOutDto, EmailOutDto, EmailOut, int>, IEmailOutService public class EmailOutService : CRUDService<IEmailOutRepository, EmailOutCreateDto, EmailOutDto, EmailOutDto, EmailOut, int>, IEmailOutService
{ {
public EmailOutService(IEmailOutRepository repository, IStringLocalizer<TResource> localizer, IMapper mapper) : base(repository, localizer, mapper) public EmailOutService(IEmailOutRepository repository, IMapper mapper) : base(repository, mapper)
{ {
} }