Deprecate controllers/services; simplify generics
Added `[Obsolete("Use MediatR")]` attributes to various controller and service classes to indicate deprecation in favor of MediatR. Simplified generic type constraints in `CRUDControllerBase` and related files by removing `IUnique<TId>`. Improved structure and documentation in `CSPMiddleware.cs`. Introduced new extension methods in `EntityExtensions.cs` for safer retrieval of 'Id' properties. Removed `IUnique.cs` interface and updated project dependencies in `DigitalData.Core.Application.csproj` for caching. Overall, these changes enhance code maintainability and clarity.
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
|
||||
namespace DigitalData.Core.Application.Interfaces
|
||||
namespace DigitalData.Core.Application.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Implements a simplified CRUD service interface that uses a single Data Transfer Object (DTO) type for all CRUD operations,
|
||||
@@ -15,8 +13,9 @@ namespace DigitalData.Core.Application.Interfaces
|
||||
/// This interface is useful for entities that do not require different DTOs for different operations,
|
||||
/// allowing for a more concise and maintainable codebase when implementing services for such entities.
|
||||
/// </remarks>
|
||||
[Obsolete("Use MediatR")]
|
||||
public interface IBasicCRUDService<TDto, TEntity, TId> : ICRUDService<TDto, TDto, TEntity, TId>
|
||||
where TDto : class, IUnique<TId> where TEntity : class, IUnique<TId>
|
||||
where TDto : class where TEntity : class
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
using DigitalData.Core.Application.DTO;
|
||||
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, IUnique<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}"/>.
|
||||
@@ -21,6 +21,6 @@ namespace DigitalData.Core.Application.Interfaces
|
||||
/// </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) where TUpdateDto : IUnique<TId>;
|
||||
Task<Result> UpdateAsync<TUpdateDto>(TUpdateDto updateDto);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace DigitalData.Core.Application.Interfaces
|
||||
{
|
||||
[Obsolete("Use MediatR")]
|
||||
public interface IReadService<TReadDto, TEntity, TId>
|
||||
where TReadDto : class where TEntity : class
|
||||
{
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
using DigitalData.Core.Abstractions;
|
||||
|
||||
namespace DigitalData.Core.Application.Interfaces.Repository
|
||||
namespace DigitalData.Core.Application.Interfaces.Repository
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for CRUD operations on a repository for entities of type TEntity.
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity">The type of the entity this repository works with.</typeparam>
|
||||
/// <typeparam name="TId">The type of the identifier for the entity.</typeparam>
|
||||
public interface ICRUDRepository<TEntity, TId> where TEntity : class, IUnique<TId>
|
||||
public interface ICRUDRepository<TEntity, TId> where TEntity : class
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds a new entity to the repository.
|
||||
|
||||
Reference in New Issue
Block a user