diff --git a/DigitalData.Core.Abstractions/Application/ICRUDService.cs b/DigitalData.Core.Abstractions/Application/ICRUDService.cs index 9dfec8d..2c6074d 100644 --- a/DigitalData.Core.Abstractions/Application/ICRUDService.cs +++ b/DigitalData.Core.Abstractions/Application/ICRUDService.cs @@ -4,7 +4,7 @@ using DigitalData.Core.DTO; namespace DigitalData.Core.Abstractions.Application { public interface ICRUDService - where TCreateDto : class where TReadDto : class where TUpdateDto : IUnique where TEntity : class + where TCreateDto : class where TReadDto : class where TUpdateDto : IUnique where TEntity : class, IUnique { Task> CreateAsync(TCreateDto createDto); diff --git a/DigitalData.Core.Abstractions/Infrastructure/ICRUDRepository.cs b/DigitalData.Core.Abstractions/Infrastructure/ICRUDRepository.cs index 4223d82..15e022f 100644 --- a/DigitalData.Core.Abstractions/Infrastructure/ICRUDRepository.cs +++ b/DigitalData.Core.Abstractions/Infrastructure/ICRUDRepository.cs @@ -5,7 +5,7 @@ /// /// The type of the entity this repository works with. /// The type of the identifier for the entity. - public interface ICRUDRepository where TEntity : class + public interface ICRUDRepository where TEntity : class, IUnique { /// /// Adds a new entity to the repository. diff --git a/DigitalData.Core.Application/CRUDService.cs b/DigitalData.Core.Application/CRUDService.cs index 21cca2e..d737680 100644 --- a/DigitalData.Core.Application/CRUDService.cs +++ b/DigitalData.Core.Application/CRUDService.cs @@ -18,7 +18,7 @@ namespace DigitalData.Core.Application /// The entity type. /// The type of the identifier for the entity. public class CRUDService : ICRUDService - where TCRUDRepository : ICRUDRepository where TCreateDto : class where TReadDto : class where TUpdateDto : IUnique where TEntity : class + where TCRUDRepository : ICRUDRepository where TCreateDto : class where TReadDto : class where TUpdateDto : IUnique where TEntity : class, IUnique { protected readonly TCRUDRepository _repository; protected readonly IMapper _mapper; diff --git a/DigitalData.Core.Infrastructure/CRUDRepository.cs b/DigitalData.Core.Infrastructure/CRUDRepository.cs index 1ac6b45..db8b902 100644 --- a/DigitalData.Core.Infrastructure/CRUDRepository.cs +++ b/DigitalData.Core.Infrastructure/CRUDRepository.cs @@ -1,4 +1,5 @@ -using DigitalData.Core.Abstractions.Infrastructure; +using DigitalData.Core.Abstractions; +using DigitalData.Core.Abstractions.Infrastructure; using Microsoft.EntityFrameworkCore; namespace DigitalData.Core.Infrastructure @@ -14,7 +15,7 @@ namespace DigitalData.Core.Infrastructure /// It leverages the EF Core's DbContext and DbSet to perform these operations. /// public class CRUDRepository : ICRUDRepository - where TEntity : class + where TEntity : class, IUnique where TDbContext : DbContext { protected readonly TDbContext _dbContext;