2
I’m following a tutorial in which classes are configured as follows:
A class called Automapperconfig:
public class AutoMapperConfig
{
public static void RegisterMappings()
{
Mapper.Initialize(x =>
{
x.AddProfile<DomainToViewModelMappingProfile>();
x.AddProfile<ViewModelToDomainMappingProfile>();
});
}
}
Another class called Domaintoviewmodelmappingprofile, which maps from Dominio 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 one 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()
You are in error, I believe that because the version of the Automapper I am using is the latest, and the tutorial is the 3.2.1, someone would know how to solve this?
What’s the mistake ?
– ramaral
Viewmodeltodomainmappingprofile.Configure: no suitable method found to override
– Caio Vinícius