NuGet ABP 4.9
See original GitHub issueNuGet ABP 4.9
I found the ABP 4.9 in NuGet, https://www.nuget.org/packages/Abp
AbpAutoMapperModule
In AbpAutoMapperModule
, register the Mapper.Instance for IMapper.
if (Configuration.Modules.AbpAutoMapper().UseStaticMapper)
{
//We should prevent duplicate mapping in an application, since Mapper is static.
if (!_createdMappingsBefore)
{
Mapper.Initialize(configurer);
_createdMappingsBefore = true;
}
IocManager.IocContainer.Register(
Component.For<IConfigurationProvider>().Instance(Mapper.Configuration).LifestyleSingleton()
);
IocManager.IocContainer.Register(
Component.For<IMapper>().Instance(Mapper.Instance).LifestyleSingleton()
);
}
else
{
var config = new MapperConfiguration(configurer);
IocManager.IocContainer.Register(
Component.For<IConfigurationProvider>().Instance(config).LifestyleSingleton()
);
IocManager.IocContainer.Register(
Component.For<IMapper>().Instance(config.CreateMapper()).LifestyleSingleton()
);
}
and then, I use Mapper.Instance will throw InvalidOperationException:
Mapper not initialized. Call Initialize with appropriate configuration. If you are trying to us…
but get IMapper by IcC, like:
public override void PostInitialize()
{
var b = IocManager.Resolve<IMapper>();
var a = Mapper.Instance;
}
the b
is a valid entity. b regist by Mapper.Instance, isn’t it?
Why?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Abp 4.9.0
Version Downloads Last updated
8.3.1 224 a day ago
8.3.0 62 a day ago
8.2.0 21,951 3 months ago
Read more >Abp.EntityFrameworkCore 4.9.0
Abp.EntityFrameworkCore 4.9.0. The ID prefix of this package has been reserved for one of the owners of this Prefix Reserved .NET Standard 2.0....
Read more >Abp.ZeroCore 4.9.0
Version Downloads Last updated
8.2.0 3,941 2 months ago
8.1.0 19,934 4 months ago
8.0.0 28,197 7 months ago
Read more >Abp.AspNetCore.OData 4.9.0
Abp.AspNetCore.OData 4.9.0 ·.NET CLI · Package Manager · PackageReference · Paket CLI · Script & Interactive · Cake.
Read more >Abp.Web.Common 4.9.0
Version Downloads Last updated
8.2.0 695 12 days ago
8.1.0 11,613 3 months ago
8.0.0 23,629 6 months ago
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK, I find the reason. Resharper Lied to me, I will use
AbpEmulateAutoMapper.Mapper
.The content of
AbpAutoMapperModule
has changed.see: https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.AutoMapper/AutoMapper/AbpAutoMapperModule.cs
https://github.com/aspnetboilerplate/aspnetboilerplate/issues/4667