Refactor: Erzwinge IUnique<TId> Einschränkung für TUpdateDto in CRUDService
- Aktualisiert: `ICRUDService` und `CRUDService`, um die `IUnique<TId>`-Einschränkung für `TUpdateDto` sicherzustellen, dass Update-Datenübertragungsobjekte eine eindeutige Kennung enthalten.
This commit is contained in:
parent
5f18ccd2bd
commit
d59350174c
@ -4,7 +4,7 @@ using DigitalData.Core.DTO;
|
||||
namespace DigitalData.Core.Abstractions.Application
|
||||
{
|
||||
public interface ICRUDService<TCreateDto, TReadDto, TUpdateDto, TEntity, TId>
|
||||
where TCreateDto : class where TReadDto : class where TUpdateDto : class where TEntity : class
|
||||
where TCreateDto : class where TReadDto : class where TUpdateDto : IUnique<TId> where TEntity : class
|
||||
{
|
||||
Task<DataResult<TId>> CreateAsync(TCreateDto createDto);
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ using AutoMapper;
|
||||
using System.Reflection;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using DigitalData.Core.DTO;
|
||||
using DigitalData.Core.Abstractions;
|
||||
|
||||
namespace DigitalData.Core.Application
|
||||
{
|
||||
@ -16,7 +17,7 @@ namespace DigitalData.Core.Application
|
||||
/// <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<TCreateDto, TReadDto, TUpdateDto, TEntity, TId>
|
||||
where TCRUDRepository : ICRUDRepository<TEntity, TId> where TCreateDto : class where TReadDto : class where TUpdateDto : class where TEntity : class
|
||||
where TCRUDRepository : ICRUDRepository<TEntity, TId> where TCreateDto : class where TReadDto : class where TUpdateDto : IUnique<TId> where TEntity : class
|
||||
{
|
||||
protected readonly TCRUDRepository _repository;
|
||||
protected readonly IMapper _mapper;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user