0

Please or Register to create posts and topics.

Problem with version 2.8

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.

If in my code:

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?

Hi,

 

I resolved it!!