Refactored ICRUDService interface to remove the generic TCRUDRepository parameter for simplification and improved readability.

This commit is contained in:
Developer 02
2024-06-15 00:41:24 +02:00
parent 0697f5ff58
commit 3844f9d8d8
8 changed files with 29 additions and 32 deletions

View File

@@ -20,7 +20,7 @@ namespace DigitalData.Core.Application
/// and a culture-specific translation service for any necessary text translations, ensuring a versatile and internationalized approach to CRUD operations.
/// </remarks>
public class BasicCRUDService<TCRUDRepository, TDto, TEntity, TId> :
CRUDService<TCRUDRepository, TDto, TDto, TDto, TEntity, TId>, IBasicCRUDService<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
{
/// <summary>

View File

@@ -15,7 +15,7 @@ namespace DigitalData.Core.Application
/// <typeparam name="TUpdateDto">The DTO type for update operations.</typeparam>
/// <typeparam name="TEntity">The entity type.</typeparam>
/// <typeparam name="TId">The type of the identifier for the entity.</typeparam>
public class CRUDService<TCRUDRepository, TCreateDto, TReadDto, TUpdateDto, TEntity, TId> : ICRUDService<TCRUDRepository, TCreateDto, TReadDto, TUpdateDto, TEntity, TId>
public class CRUDService<TCRUDRepository, TCreateDto, TReadDto, TUpdateDto, TEntity, TId> : ICRUDService<TCreateDto, TReadDto, TUpdateDto, TEntity, TId>
where TCRUDRepository : ICRUDRepository<TEntity, TId> where TCreateDto : class where TReadDto : class where TUpdateDto : class where TEntity : class
{
protected readonly TCRUDRepository _repository;

View File

@@ -25,7 +25,7 @@ namespace DigitalData.Core.Application
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
{
services.AddScoped<IBasicCRUDService<TCRUDRepository, TDto, TEntity, TId>, BasicCRUDService<TCRUDRepository, TDto, TEntity, TId>>();
services.AddScoped<IBasicCRUDService<TDto, TEntity, TId>, BasicCRUDService<TCRUDRepository, TDto, TEntity, TId>>();
configureService?.Invoke(services);
services.AddAutoMapper(typeof(TProfile).Assembly);
@@ -49,7 +49,7 @@ namespace DigitalData.Core.Application
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
{
services.AddScoped<ICRUDService<TCRUDRepository, TCreateDto, TReadDto, TUpdateDto, TEntity, TId>, CRUDService<TCRUDRepository, TCreateDto, TReadDto, TUpdateDto, TEntity, TId>>();
services.AddScoped<ICRUDService<TCreateDto, TReadDto, TUpdateDto, TEntity, TId>, CRUDService<TCRUDRepository, TCreateDto, TReadDto, TUpdateDto, TEntity, TId>>();
configureService?.Invoke(services);
services.AddAutoMapper(typeof(TProfile).Assembly);