I'm following a tutorial in which classes are configured as follows:
A class named AutoMapperConfig:
public class AutoMapperConfig
{
public static void RegisterMappings()
{
Mapper.Initialize(x =>
{
x.AddProfile<DomainToViewModelMappingProfile>();
x.AddProfile<ViewModelToDomainMappingProfile>();
});
}
}
Another class called DomainToViewModelMappingProfile, which does the mapping from Domain to ViewModel:
public class DomainToViewModelMappingProfile : Profile
{
public override string ProfileName
{
get { return "ViewModelToDomainMappings"; }
}
protected override void Configure()
{
CreateMap<ClienteViewModel, Cliente>();
CreateMap<ProdutoViewModel, Produto>();
}
}
And a third called ViewModelToDomainMappingProfile that maps from ViewModel to the Domain:
public class ViewModelToDomainMappingProfile : Profile
{
public override string ProfileName
{
get { return "DomainToViewModelMappings"; }
}
protected override void Configure()
{
CreateMap<ClienteViewModel, Cliente>();
CreateMap<ProdutoViewModel, Produto>();
}
}
What happens is that in:
protected override void Configure()