Browse Source

Set _createdMappingsBefore before the initialization.

pull/1250/head
Halil İbrahim Kalkan 7 years ago
parent
commit
8b17025439
  1. 4
      framework/src/Volo.Abp.AutoMapper/Volo/Abp/AutoMapper/AbpAutoMapperModule.cs

4
framework/src/Volo.Abp.AutoMapper/Volo/Abp/AutoMapper/AbpAutoMapperModule.cs

@ -59,14 +59,14 @@ namespace Volo.Abp.AutoMapper
//We should prevent duplicate mapping in an application, since Mapper is static.
if (!_createdMappingsBefore)
{
_createdMappingsBefore = true;
Mapper.Initialize(mapperConfigurationExpression =>
{
ConfigureAll(new AbpAutoMapperConfigurationContext(mapperConfigurationExpression, scope.ServiceProvider));
});
ValidateAll(Mapper.Configuration);
_createdMappingsBefore = true;
}
scope.ServiceProvider.GetRequiredService<MapperAccessor>().Mapper = Mapper.Instance;

Loading…
Cancel
Save