using Microsoft.Extensions.DependencyInjection; using Opsoft.NetCore.O3App.Shared; namespace Opsoft.NetCore.O3App.Infrastructure { [MapTo(typeof(IMapper), ServiceLifetime.Singleton)] public class ObjectMapper : IMapper { private readonly AutoMapper.IMapper mapper; public ObjectMapper(AutoMapper.IMapper mapper) { this.mapper = Guard.ArgumentNotNull(mapper, nameof(mapper)); } public TDestination Map(object source) { return mapper.Map(source); } public TDestination Map(TSource source, TDestination destination) { return mapper.Map(source, destination); } } }