Developer 02 3a1aeb7ac3 Refactor namespaces and enhance application structure
This commit reorganizes namespaces from `DigitalData.Core.Abstractions` and `DigitalData.Core.DTO` to `DigitalData.Core.Application.Interfaces` and `DigitalData.Core.Application.DTO`, improving maintainability and clarity.

Updated using directives across multiple files to reflect the new structure, ensuring functionality remains intact.

Project references in `DigitalData.Core.API.csproj` have been consolidated to include the new Application project.

Introduced new classes and interfaces such as `BaseDTO`, `CookieConsentSettings`, `DataResult`, `Notice`, and `Result` to enhance data transfer and service result handling.

Updated `IRepository`, `ICRUDRepository`, and `IEntityMapper` interfaces to facilitate CRUD operations and entity mapping.

Added extension methods in `Extensions.cs` to improve repository usability.

New interfaces for HTTP client services have been added, enhancing external API call handling.

Overall, these changes reflect a significant restructuring aimed at improving organization and preparing for future development.
2025-05-16 11:24:58 +02:00

35 lines
2.3 KiB
C#

using AutoMapper;
using DigitalData.Core.Abstractions;
using DigitalData.Core.Application.Interfaces;
using DigitalData.Core.Application.Interfaces.Repository;
namespace DigitalData.Core.Application
{
/// <summary>
/// Provides a concrete implementation of a basic CRUD service that uses a single Data Transfer Object (DTO) for all CRUD operations.
/// This service simplifies the management of entities by utilizing a consistent object model throughout create, read, update, and delete operations.
/// It extends the generic CRUDService by specifying the same DTO type for all generic parameters, facilitating a straightforward mapping between the entity and its data transfer representation.
/// </summary>
/// <typeparam name="TDto">The Data Transfer Object type used for all operations.</typeparam>
/// <typeparam name="TEntity">The entity type being managed by this service.</typeparam>
/// <typeparam name="TId">The type of the identifier for the entity.</typeparam>
/// <remarks>
/// This service is ideal for scenarios where a single DTO is adequate to represent the entity in all operations,
/// reducing the need for multiple DTOs and simplifying the data mapping process. It leverages AutoMapper for object mapping
/// and a culture-specific translation service for any necessary text translations, ensuring a versatile and internationalized approach to CRUD operations.
/// </remarks>
public class BasicCRUDService<TCRUDRepository, TDto, TEntity, TId> :
CRUDService<TCRUDRepository, TDto, TDto, TEntity, TId>, IBasicCRUDService<TDto, TEntity, TId>
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.
/// </summary>
/// <param name="repository">The CRUD repository for accessing and manipulating entity data.</param>
/// <param name="mapper">The AutoMapper instance for mapping between DTOs and entities.</param>
public BasicCRUDService(TCRUDRepository repository, IMapper mapper) :
base(repository, mapper)
{
}
}
}