Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class AutoMapperConfig
- {
- public static void RegisterMappings()
- {
- Mapper.Initialize(x =>
- {
- x.AddProfile<DomainToViewModelMappingProfile>();
- x.AddProfile<ViewModelToDomainMappingProfile>();
- });
- }
- }
- public class DomainToViewModelMappingProfile : Profile
- {
- public override string ProfileName
- {
- get { return "ViewModelToDomainMappings"; }
- }
- protected override void Configure()
- {
- CreateMap<ClienteViewModel, Cliente>();
- CreateMap<ProdutoViewModel, Produto>();
- }
- }
- public class ViewModelToDomainMappingProfile : Profile
- {
- public override string ProfileName
- {
- get { return "DomainToViewModelMappings"; }
- }
- protected override void Configure()
- {
- CreateMap<ClienteViewModel, Cliente>();
- CreateMap<ProdutoViewModel, Produto>();
- }
- }
Add Comment
Please, Sign In to add comment