refactor: Einführung des IUnique<TId>-Interfaces für Entitäten und DTOs

- Aktualisiertes IBasicCRUDService-Interface, um Konsistenz bei einzigartigen Identifikatoren mit IUnique<TId> durchzusetzen
- DIExtensions-Methoden angepasst, um IUnique<TId>-Einschränkungen für DTOs und Entitäten einzuschließen
This commit is contained in:
Developer 02
2024-09-13 16:30:52 +02:00
parent b6ac303c96
commit 0bf8979a09
5 changed files with 14 additions and 11 deletions

View File

@@ -1,4 +1,5 @@
using DigitalData.Core.Abstractions.Infrastructure;
using DigitalData.Core.Abstractions;
using DigitalData.Core.Abstractions.Infrastructure;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using System.DirectoryServices;
@@ -17,7 +18,7 @@ namespace DigitalData.Core.Infrastructure
/// <param name="configureRepository">An optional action to configure additional services for the repository.</param>
/// <returns>The original <see cref="IServiceCollection"/> instance, allowing further configuration.</returns>
public static IServiceCollection AddCleanCRUDRepository<TEntity, TId, TDbContext, TCRUDRepository>(this IServiceCollection services, Action<IServiceCollection>? configureRepository = null)
where TCRUDRepository : CRUDRepository<TEntity, TId, TDbContext> where TEntity : class where TDbContext : DbContext
where TCRUDRepository : CRUDRepository<TEntity, TId, TDbContext> where TEntity : class, IUnique<TId> where TDbContext : DbContext
{
services.AddScoped<ICRUDRepository<TEntity, TId>, TCRUDRepository>();
configureRepository?.Invoke(services);