feat(EntityAutoMapper): Erstellt mit der Konfiguration der Dependency Injection.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
using AutoMapper;
|
||||
using DigitalData.Core.Abstractions.Infrastructure;
|
||||
|
||||
namespace DigitalData.Core.Infrastructure.AutoMapper;
|
||||
|
||||
public class EntityAutoMapper<TEntity> : IEntityMapper<TEntity>
|
||||
{
|
||||
private readonly IMapper _rootMapper;
|
||||
|
||||
public EntityAutoMapper(IMapper rootMapper)
|
||||
{
|
||||
_rootMapper = rootMapper;
|
||||
}
|
||||
|
||||
public TDto Map<TDto>(TEntity entity) => _rootMapper.Map<TDto>(entity);
|
||||
|
||||
public TEntity Map<TDto>(TDto dto) => _rootMapper.Map<TEntity>(dto);
|
||||
|
||||
public TEntity Map<TDto>(TDto dto, TEntity entity) => _rootMapper.Map(dto, entity);
|
||||
}
|
||||
Reference in New Issue
Block a user