This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//configuration, se réalise habituellement au démarrage de votre application | |
Mapper.CreateMap<Model, ViewModel>(); | |
//création d'un objet "Model" pouvant provenir d'une base de données | |
var model = new Model | |
{ | |
PageTitle = "Titre de page" | |
}; | |
//Mappage du Model en ViewModel | |
var viewModel = Mapper.Map<Model, ViewModel>(model); | |
//retourne "Model | |
Console.WriteLine(viewModel.PageTitle); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment