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:
parent
b6ac303c96
commit
0bf8979a09
@ -16,7 +16,7 @@ namespace DigitalData.Core.Abstractions.Application
|
||||
/// allowing for a more concise and maintainable codebase when implementing services for such entities.
|
||||
/// </remarks>
|
||||
public interface IBasicCRUDService<TDto, TEntity, TId> : ICRUDService<TDto, TDto, TDto, TEntity, TId>
|
||||
where TDto : class where TEntity : class
|
||||
where TDto : class, IUnique<TId> where TEntity : class, IUnique<TId>
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Abstractions;
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
|
||||
@ -19,7 +20,7 @@ namespace DigitalData.Core.Application
|
||||
/// </remarks>
|
||||
public class BasicCRUDService<TCRUDRepository, TDto, TEntity, TId> :
|
||||
CRUDService<TCRUDRepository, TDto, TDto, TDto, TEntity, TId>, IBasicCRUDService<TDto, TEntity, TId>
|
||||
where TCRUDRepository : ICRUDRepository<TEntity, TId> where TDto : class where TEntity : class
|
||||
where TCRUDRepository : ICRUDRepository<TEntity, TId> where TDto : class, IUnique<TId> where TEntity : class, IUnique<TId>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the BasicCRUDService with the specified repository, translation service, and AutoMapper configuration.
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Abstractions;
|
||||
using DigitalData.Core.Abstractions.Application;
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@ -23,7 +24,7 @@ namespace DigitalData.Core.Application
|
||||
/// <param name="configureService">An optional action to configure additional services for the CRUD service.</param>
|
||||
/// <returns>The original <see cref="IServiceCollection"/> instance, allowing further configuration.</returns>
|
||||
public static IServiceCollection AddCleanBasicCRUDService<TCRUDRepository, TDto, TEntity, TId, TProfile>(this IServiceCollection services, Action<IServiceCollection>? configureService = null)
|
||||
where TCRUDRepository : ICRUDRepository<TEntity, TId> where TDto : class where TEntity : class where TProfile : Profile
|
||||
where TCRUDRepository : ICRUDRepository<TEntity, TId> where TDto : class, IUnique<TId> where TEntity : class, IUnique<TId> where TProfile : Profile
|
||||
{
|
||||
services.AddScoped<IBasicCRUDService<TDto, TEntity, TId>, BasicCRUDService<TCRUDRepository, TDto, TEntity, TId>>();
|
||||
configureService?.Invoke(services);
|
||||
@ -47,7 +48,7 @@ namespace DigitalData.Core.Application
|
||||
/// <param name="configureService">An optional action to configure additional services for the CRUD service.</param>
|
||||
/// <returns>The original <see cref="IServiceCollection"/> instance, allowing further configuration.</returns>
|
||||
public static IServiceCollection AddCleanCRUDService<TCRUDRepository, TCreateDto, TReadDto, TUpdateDto, TEntity, TId, TProfile>(this IServiceCollection services, Action<IServiceCollection>? configureService = null)
|
||||
where TCRUDRepository : ICRUDRepository<TEntity, TId> where TCreateDto : class where TReadDto : class where TUpdateDto : class where TEntity : class where TProfile : Profile
|
||||
where TCRUDRepository : ICRUDRepository<TEntity, TId> where TCreateDto : class where TReadDto : class where TUpdateDto : class, IUnique<TId> where TEntity : class, IUnique<TId> where TProfile : Profile
|
||||
{
|
||||
services.AddScoped<ICRUDService<TCreateDto, TReadDto, TUpdateDto, TEntity, TId>, CRUDService<TCRUDRepository, TCreateDto, TReadDto, TUpdateDto, TEntity, TId>>();
|
||||
configureService?.Invoke(services);
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -27,12 +27,12 @@ Global
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A765EBEA-3D1E-4F36-869B-6D72F87FF3F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A765EBEA-3D1E-4F36-869B-6D72F87FF3F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A765EBEA-3D1E-4F36-869B-6D72F87FF3F6}.Debug|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A765EBEA-3D1E-4F36-869B-6D72F87FF3F6}.Debug|Any CPU.Build.0 = Release|Any CPU
|
||||
{A765EBEA-3D1E-4F36-869B-6D72F87FF3F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A765EBEA-3D1E-4F36-869B-6D72F87FF3F6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DB404CD9-CBB8-4771-AB1B-FD4FDE2C28CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DB404CD9-CBB8-4771-AB1B-FD4FDE2C28CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DB404CD9-CBB8-4771-AB1B-FD4FDE2C28CC}.Debug|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DB404CD9-CBB8-4771-AB1B-FD4FDE2C28CC}.Debug|Any CPU.Build.0 = Release|Any CPU
|
||||
{DB404CD9-CBB8-4771-AB1B-FD4FDE2C28CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DB404CD9-CBB8-4771-AB1B-FD4FDE2C28CC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C57B2480-F632-4691-9C4C-8CC01237203C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
@ -51,7 +51,7 @@ Global
|
||||
{6A80FFEC-9B83-40A7-8C78-124440B48B33}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6A80FFEC-9B83-40A7-8C78-124440B48B33}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6A80FFEC-9B83-40A7-8C78-124440B48B33}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{13E40DF1-6123-4838-9BF8-086C94E6ADF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{13E40DF1-6123-4838-9BF8-086C94E6ADF6}.Debug|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{13E40DF1-6123-4838-9BF8-086C94E6ADF6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{13E40DF1-6123-4838-9BF8-086C94E6ADF6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{84B18026-F9A0-4366-BC69-1662D9E7342D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user