Closed IngoManthey closed 5 years ago
the problem is you initializing the automapper - this was changed in the latest to an instance based mapping (as automapper is getting ride of the static contructor), so ensure you have an instance of automapper in your IOC (there are enables in most of the controllers). eg CustomerController
auto look at the automapper doc too. Should be a 2 min fix.
Post the class you've created if you need more help.
Hi, Unfortunately, I can not solve my present without your help! That's why I ask you to help me. I have a separate library where I send and receive SOAP jobs. This program works in a Thread.
var response = req.GetResponse ();
the following happens. The mapper is called.CreateMap<ApplicationRole, RoleViewModel>() .ForMember(d => d.Permissions, map => map.MapFrom(s => s.Claims)) .ForMember(d => d.UsersCount, map => map.MapFrom(s => s.Users != null ? s.Users.Count : 0)) .ReverseMap();
Destination Member: Permissions ---> System.InvalidOperationException: Mapper not initialized. Call Initialize with appropriate configuration. If you are trying to use mapper instances through a container or otherwise, make sure you do not have any calls to the static Mapper.Map methods, and if you're using ProjectTo or UseAsDataSource extension methods, make sure you pass in the appropriate IConfigurationProvider instance. at AutoMapper.Mapper.get_Instance() in C:\projects\automapper\src\AutoMapper\Mapper.cs:line 36 Although I have found that the mapping is registered in the Start.cs.services.AddIdentity<ApplicationUser, ApplicationRole>() .AddEntityFrameworkStores<ApplicationDbContext>() .AddDefaultTokenProviders();
What can I do to make my program run again?regards Ingo