How to do AutoMapper Initialization for multiple files/class without changing any old code?

Viewed 33

There are multiple projects in my solution. I have to add new AutoMapperConfigB file in one of the Project. Already one AutoMapperConfigA is present in one project and it is initalized using the Mapper.Initialize(AutoMapperConfigA.Configure);

I am unable to initialize another AutomapperConfigB file as Mapper.Initialize will not allow to initialize multiple Automapper class file.

I searched that we can create Profile and then with that we can initialize multiple files.

However, for that I have to change the existing AutomapperConfigA class file as if contains IMapperConfigurationExpression mc and all the mapping is done using this. And some of the mapping is very complex.

Question - Is there a way I can initialize old AutomapperConfigA and new AutmapperConfigB without changing anything in the AutomapperConfigA Class ?

I can create new AutomapperConfigB as profile also.

0 Answers
Related