Skip to content

Instantly share code, notes, and snippets.

@pparadis
Created September 9, 2014 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pparadis/0324615c23a3e04061d4 to your computer and use it in GitHub Desktop.
Save pparadis/0324615c23a3e04061d4 to your computer and use it in GitHub Desktop.
//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