Fix duplicate automapper profiles (#270)

This commit is contained in:
Sipke Schoorstra 2020-03-27 21:11:05 +01:00 committed by GitHub
parent 707eed6f6f
commit 5bf994c485
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -18,7 +18,8 @@ namespace Elsa.AutoMapper.Extensions
public static IServiceCollection AddAutoMapperProfile<TProfile>(this IServiceCollection services, ServiceLifetime lifetime) where TProfile : Profile
{
services.AddAutoMapper(lifetime);
return services.AddTransient<Profile, TProfile>();
services.TryAddTransient(typeof(Profile), typeof(TProfile));
return services;
}
private static IConfigurationProvider CreateConfigurationProvider(IServiceProvider serviceProvider)