refactor: Einführung des IUnique<TId>-Interfaces für Entitäten und DTOs
- Aktualisiertes IBasicCRUDService-Interface, um Konsistenz bei einzigartigen Identifikatoren mit IUnique<TId> durchzusetzen - DIExtensions-Methoden angepasst, um IUnique<TId>-Einschränkungen für DTOs und Entitäten einzuschließen
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Abstractions;
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
|
||||
@@ -19,7 +20,7 @@ namespace DigitalData.Core.Application
|
||||
/// </remarks>
|
||||
public class BasicCRUDService<TCRUDRepository, TDto, TEntity, TId> :
|
||||
CRUDService<TCRUDRepository, TDto, TDto, TDto, TEntity, TId>, IBasicCRUDService<TDto, TEntity, TId>
|
||||
where TCRUDRepository : ICRUDRepository<TEntity, TId> where TDto : class where TEntity : class
|
||||
where TCRUDRepository : ICRUDRepository<TEntity, TId> where TDto : class, IUnique<TId> where TEntity : class, IUnique<TId>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the BasicCRUDService with the specified repository, translation service, and AutoMapper configuration.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Abstractions;
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@@ -23,7 +24,7 @@ namespace DigitalData.Core.Application
|
||||
/// <param name="configureService">An optional action to configure additional services for the CRUD service.</param>
|
||||
/// <returns>The original <see cref="IServiceCollection"/> instance, allowing further configuration.</returns>
|
||||
public static IServiceCollection AddCleanBasicCRUDService<TCRUDRepository, TDto, TEntity, TId, TProfile>(this IServiceCollection services, Action<IServiceCollection>? configureService = null)
|
||||
where TCRUDRepository : ICRUDRepository<TEntity, TId> where TDto : class where TEntity : class where TProfile : Profile
|
||||
where TCRUDRepository : ICRUDRepository<TEntity, TId> where TDto : class, IUnique<TId> where TEntity : class, IUnique<TId> where TProfile : Profile
|
||||
{
|
||||
services.AddScoped<IBasicCRUDService<TDto, TEntity, TId>, BasicCRUDService<TCRUDRepository, TDto, TEntity, TId>>();
|
||||
configureService?.Invoke(services);
|
||||
@@ -47,7 +48,7 @@ namespace DigitalData.Core.Application
|
||||
/// <param name="configureService">An optional action to configure additional services for the CRUD service.</param>
|
||||
/// <returns>The original <see cref="IServiceCollection"/> instance, allowing further configuration.</returns>
|
||||
public static IServiceCollection AddCleanCRUDService<TCRUDRepository, TCreateDto, TReadDto, TUpdateDto, TEntity, TId, TProfile>(this IServiceCollection services, Action<IServiceCollection>? configureService = null)
|
||||
where TCRUDRepository : ICRUDRepository<TEntity, TId> where TCreateDto : class where TReadDto : class where TUpdateDto : class where TEntity : class where TProfile : Profile
|
||||
where TCRUDRepository : ICRUDRepository<TEntity, TId> where TCreateDto : class where TReadDto : class where TUpdateDto : class, IUnique<TId> where TEntity : class, IUnique<TId> where TProfile : Profile
|
||||
{
|
||||
services.AddScoped<ICRUDService<TCreateDto, TReadDto, TUpdateDto, TEntity, TId>, CRUDService<TCRUDRepository, TCreateDto, TReadDto, TUpdateDto, TEntity, TId>>();
|
||||
configureService?.Invoke(services);
|
||||
|
||||
Reference in New Issue
Block a user