Modified the `GetId<TId>` method in the `EntityExtensions` class to change its return type from nullable `TId?` to non-nullable `TId`, ensuring stricter type safety by throwing an `InvalidOperationException` when the `Id` property is not readable. Removed a summary comment in the `ICRUDService` interface related to the `CreateAsync` method, which may indicate ongoing documentation updates for clarity on the method's functionality and parameters.
25 lines
1.6 KiB
C#
25 lines
1.6 KiB
C#
using DigitalData.Core.Application.DTO;
|
|
|
|
namespace DigitalData.Core.Application.Interfaces
|
|
{
|
|
[Obsolete("Use MediatR")]
|
|
public interface ICRUDService<TCreateDto, TReadDto, TEntity, TId> : IReadService<TReadDto, TEntity, TId>
|
|
where TCreateDto : class where TReadDto : class where TEntity : class
|
|
{
|
|
/// <summary>
|
|
/// Asynchronously creates a new entity based on the provided <paramref name="createDto"/> and returns the identifier of the created entity wrapped in a <see cref="DataResult{TId}"/>.
|
|
/// The <see cref="DataResult{TId}"/> contains the identifier of the newly created entity on success or an error message on failure.
|
|
/// </summary>
|
|
/// <param name="createDto">The data transfer object containing the information for the new entity.</param>
|
|
/// <returns>A task representing the asynchronous operation, with a <see cref="DataResult{TId}"/> containing the identifier of the created entity or an error message.</returns>
|
|
Task<DataResult<TId>> CreateAsync(TCreateDto createDto);
|
|
|
|
/// <summary>
|
|
/// Updates an existing entity based on the provided updateDTO 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="updateDto">The updateDTO with updated values for the entity.</param>
|
|
/// <returns>An Result indicating the outcome of the update operation, with an appropriate message.</returns>
|
|
Task<Result> UpdateAsync<TUpdateDto>(TUpdateDto updateDto);
|
|
}
|
|
} |