using Microsoft.Extensions.DependencyInjection; namespace DigitalData.Core.Infrastructure.AutoMapper; public static class DependencyInjection { public static EntityConfigurationOptions UseAutoMapper(this EntityConfigurationOptions options, params Type[] typeOfDtos) { options.AddCustomMapper>(services => { if (typeOfDtos.Length != 0) { services.AddAutoMapper(cnf => { foreach (var typeOfDto in typeOfDtos) { cnf.CreateMap(typeof(TEntity), typeOfDto); cnf.CreateMap(typeOfDto, typeof(TEntity)); } }); } }); return options; } }