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

@@ -8,7 +8,6 @@ namespace DigitalData.Core.Contracts.Application
/// This interface inherits from the ICRUDService interface, applying the same DTO type for all generic type parameters,
/// thereby simplifying the usage for cases where a single DTO is sufficient for all operations on an entity.
/// </summary>
/// <typeparam name="TCRUDRepository">The repository type that provides CRUD operations for entities of type TEntity.</typeparam>
/// <typeparam name="TDto">The type of the Data Transfer Object used for all CRUD operations.</typeparam>
/// <typeparam name="TEntity">The type of the entity this service maps to.</typeparam>
/// <typeparam name="TId">The type of the identifier for the entity.</typeparam>
@@ -16,8 +15,8 @@ namespace DigitalData.Core.Contracts.Application
/// This interface is useful for entities that do not require different DTOs for different operations,
/// allowing for a more concise and maintainable codebase when implementing services for such entities.
/// </remarks>
public interface IBasicCRUDService<TCRUDRepository, TDto, TEntity, TId> : ICRUDService<TCRUDRepository, TDto, TDto, TDto, TEntity, TId>
where TCRUDRepository : ICRUDRepository<TEntity, TId> where TDto : class where TEntity : class
public interface IBasicCRUDService<TDto, TEntity, TId> : ICRUDService<TDto, TDto, TDto, TEntity, TId>
where TDto : class where TEntity : class
{
}
}

View File

@@ -3,8 +3,8 @@ using DigitalData.Core.DTO;
namespace DigitalData.Core.Contracts.Application
{
public interface ICRUDService<TCRUDRepository, TCreateDto, TReadDto, TUpdateDto, TEntity, TId>
where TCRUDRepository : ICRUDRepository<TEntity, TId> where TCreateDto : class where TReadDto : class where TUpdateDto : class where TEntity : class
public interface ICRUDService<TCreateDto, TReadDto, TUpdateDto, TEntity, TId>
where TCreateDto : class where TReadDto : class where TUpdateDto : class where TEntity : class
{
Task<DataResult<TId>> CreateAsync(TCreateDto createDto);