Created
March 6, 2012 14:42
-
-
Save abdalla/1986624 to your computer and use it in GitHub Desktop.
Using AutoMApper
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
>Basic | |
Mapper.CreateMap<EventViewModel, Event>(); | |
Event _event = Mapper.Map<EventViewModel, Event>(model); | |
>Ignoring Some Fields | |
Mapper.CreateMap<EventViewModel, Event>().ForMember("EventId", r => r.Ignore()).ForMember("CreatedOn", r => r.Ignore()).ForMember("EventStatusId", r => r.Ignore()); | |
_event = Mapper.Map(model, _event); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment