Skip to content

Instantly share code, notes, and snippets.

@abdalla
Created March 6, 2012 14:42
Show Gist options
  • Save abdalla/1986624 to your computer and use it in GitHub Desktop.
Save abdalla/1986624 to your computer and use it in GitHub Desktop.
Using AutoMApper
>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