refactor(Application): Verbesserung der CRUDService zur Steigerung der Typflexibilität und Wartbarkeit

- Entfernen redundanter generischer Einschränkungen für `TUpdateDto` in `CRUDService`.
- Aktualisierung der Methode `UpdateAsync`, um einen generischen Parameter für eine bessere Typflexibilität von `TUpdateDto` einzuschließen.
- Verbesserung der Typ-Einschränkungen durch Durchsetzung von `IUnique<TId>` direkt im Methodenumfang, wo zutreffend.
- Vereinfachung der Klasse zur Einhaltung bewährter Praktiken im Design generischer Dienste.
This commit is contained in:
Developer 02
2024-12-10 23:17:41 +01:00
parent 7dd91c73c4
commit 8d9de4502e
8 changed files with 13 additions and 17 deletions

View File

@@ -11,13 +11,12 @@ namespace DigitalData.Core.API
/// <typeparam name="TCRUDService">The derived CRUD service type implementing ICRUDService<TCreateDto, TReadDto, TUpdateDto, TEntity, TId>.</typeparam>
/// <typeparam name="TCreateDto">The Data Transfer Object type for create operations.</typeparam>
/// <typeparam name="TReadDto">The Data Transfer Object type for read operations.</typeparam>
/// <typeparam name="TUpdateDto">The Data Transfer Object type for update operations.</typeparam>
/// <typeparam name="TEntity">The entity type CRUD operations will be performed on.</typeparam>
/// <typeparam name="TId">The type of the entity's identifier.</typeparam>
[ApiController]
[Route("api/[controller]")]
public class CRUDControllerBase<TCRUDService, TCreateDto, TReadDto, TUpdateDto, TEntity, TId> : ControllerBase
where TCRUDService : ICRUDService<TCreateDto, TReadDto, TUpdateDto, TEntity, TId>
where TCRUDService : ICRUDService<TCreateDto, TReadDto, TEntity, TId>
where TCreateDto : class
where TReadDto : class
where TUpdateDto : class, IUnique<TId>