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.
38 lines
2.1 KiB
C#
38 lines
2.1 KiB
C#
using DigitalData.Core.Application.DTO;
|
|
|
|
namespace DigitalData.Core.Application.Interfaces
|
|
{
|
|
public interface IReadService<TReadDto, TEntity, TId>
|
|
where TReadDto : class where TEntity : class
|
|
{
|
|
/// <summary>
|
|
/// Retrieves an entity by its identifier and returns its readDTO representation wrapped in an IServiceResult,
|
|
/// including the readDTO on success or null and an error message on failure.
|
|
/// </summary>
|
|
/// <param name="id">The identifier of the entity to retrieve.</param>
|
|
/// <returns>An DataResult containing the readDTO representing the found entity or null, with an appropriate message.</returns>
|
|
Task<DataResult<TReadDto>> ReadByIdAsync(TId id);
|
|
|
|
/// <summary>
|
|
/// Retrieves all entities and returns their readDTO representations wrapped in an IServiceResult,
|
|
/// including a collection of readDTOs on success or an error message on failure.
|
|
/// </summary>
|
|
/// <returns>An DataResult containing a collection of readDTOs representing all entities or an error message.</returns>
|
|
Task<DataResult<IEnumerable<TReadDto>>> ReadAllAsync();
|
|
|
|
/// <summary>
|
|
/// Deletes an entity by its identifier and returns the result wrapped in an IServiceMessage,
|
|
/// indicating the success or failure of the operation, including the error messages on failure.
|
|
/// </summary>
|
|
/// <param name="id">The identifier of the entity to delete.</param>
|
|
/// <returns>An Result indicating the outcome of the delete operation, with an appropriate message.</returns>
|
|
Task<Result> DeleteAsyncById(TId id);
|
|
|
|
/// <summary>
|
|
/// Asynchronously checks if an entity with the specified identifier exists within the data store.
|
|
/// </summary>
|
|
/// <param name="id">The identifier of the entity to check.</param>
|
|
/// <returns>A task that represents the asynchronous operation. The task result contains a boolean value indicating whether the entity exists.</returns>
|
|
Task<bool> HasEntity(TId id);
|
|
}
|
|
} |