Developer 02 5465fe5b49 feat(IEntityMapper): Erstellt, um Mapper zu abstrahieren.
- Integriert in IRepository und Repository
2025-04-22 11:10:55 +02:00

35 lines
1.4 KiB
C#

namespace DigitalData.Core.Abstractions.Infrastructure
{
/// <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 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 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);
}
}