I\'m using Automapper in Asp.net mvc application. I have a question regard to the usage of automapper
from lots of sample code, I saw people use mapper Mapper.
if you have service layer in your application, it's better to place the automapper in service layer. in any case try to use extension method for mapping your object by automapper like this:
public static class Mapping
{
public static BankflowData CreateBankflowAdjustments(this BankflowData addedBankFlow)
{
var bankflow = Mapper.Map(addedBankFlow);
var newBankflow = Underlying.CreateBankFlowAdjustments(bankflow);
return Mapper.Map(newBankflow);
}
}
it will make your code more readable and will separate your concerns. take this for more info