I am using automapper 7 but the documentation of this version is not very explicit I have implemented in this way.
1) I declare at the class level.
private MapperConfiguration _config;
2) Implement in this way to map from one entity to another.
public void Creado(ProductoCatalogoExtend entity)
{
_config = new MapperConfiguration(cfg =>
{
cfg.CreateMap<ProductoCatalogoExtend, ProductoCatalogo>();
});
var mapper = _config.CreateMapper();
var dto = mapper.Map<ProductoCatalogo>(entity);
_sdProductoCatalogo.Create(dto);
}
I think this implementation can be improved, I think you can use less lines of code.
I do not find the documentation of this version very much Automapper other versions They had good documentation on Github and there were better examples.
Greetings!
Note: It is a Windows Forms app, I do not use any design pattern.