Added preprocessor directives for .NET framework compatibility. Modified `using` directives to be framework-specific. Improved code formatting for better readability. Introduced obsolete attributes for deprecated methods, recommending `MediatR` as an alternative. Added XML documentation for clarity and maintainability.
54 lines
2.1 KiB
C#
54 lines
2.1 KiB
C#
#if NETFRAMEWORK
|
|
using System.Collections.Generic;
|
|
#endif
|
|
namespace DigitalData.Core.Abstraction.Application.Repository
|
|
{
|
|
/// <summary>
|
|
/// Defines methods for mapping between entities and Data Transfer Objects (DTOs).
|
|
/// </summary>
|
|
/// <typeparam name="TEntity">The type of the entity to be mapped.</typeparam>
|
|
public interface IEntityMapper<TEntity>
|
|
{
|
|
/// <summary>
|
|
/// Maps an entity to a DTO.
|
|
/// </summary>
|
|
/// <typeparam name="TDto">The type of the DTO to map to.</typeparam>
|
|
/// <param name="entity">The entity to be mapped.</param>
|
|
/// <returns>The mapped DTO.</returns>
|
|
TDto Map<TDto>(TEntity entity);
|
|
|
|
/// <summary>
|
|
/// Maps an entity list to a DTO list.
|
|
/// </summary>
|
|
/// <typeparam name="TDto">The type of the DTO to map to.</typeparam>
|
|
/// <param name="entities">The entity list to be mapped.</param>
|
|
/// <returns>The mapped DTO list.</returns>
|
|
IEnumerable<TDto> Map<TDto>(IEnumerable<TEntity> entities);
|
|
|
|
/// <summary>
|
|
/// Maps a DTO to an entity.
|
|
/// </summary>
|
|
/// <typeparam name="TDto">The type of the DTO to be mapped.</typeparam>
|
|
/// <param name="dto">The DTO to be mapped.</param>
|
|
/// <returns>The mapped entity.</returns>
|
|
TEntity Map<TDto>(TDto dto);
|
|
|
|
/// <summary>
|
|
/// Maps a DTO list to an entity list.
|
|
/// </summary>
|
|
/// <typeparam name="TDto">The type of the DTO to be mapped.</typeparam>
|
|
/// <param name="dtos">The DTO list to be mapped.</param>
|
|
/// <returns>The mapped entity list.</returns>
|
|
IEnumerable<TEntity> Map<TDto>(IEnumerable<TDto> dtos);
|
|
|
|
/// <summary>
|
|
/// Maps a DTO to an existing entity.
|
|
/// </summary>
|
|
/// <typeparam name="TDto">The type of the DTO to be mapped.</typeparam>
|
|
/// <param name="dto">The DTO to be mapped.</param>
|
|
/// <param name="entity">The existing entity to be updated with the mapped values.</param>
|
|
/// <returns>The updated entity.</returns>
|
|
TEntity Map<TDto>(TDto dto, TEntity entity);
|
|
}
|
|
}
|