How to create AutoMapper configuration when the source and destination classes are totally different ? I want to create a mapping between some external classes (which cannot be changed) and my classes which I'm gonna persist in the db. I could persist the entire external class , but I dont want to do that to save space. I'm using .net core 2.0.
For ex: I've an external class like below :
A
{
B {
b1;b2;b3;
}
C {
c1;c2;c3;
}
}
The above needs to be mapped to my class defined like below :
A
{
Optmized_BC{
b1;
b2;
c1;
}
c2;
}
What's the best way to create AutoMapper configuration in the above case ? Should I call CreateMap for every pair of source/destination variable ? Is there a way where I can map all variables inside one CreateMap call (using some clever linq maybe ?)