Skip to content

Instantly share code, notes, and snippets.

@pykong
Created April 27, 2018 09:58
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 pykong/7472e32b2483eea3d49d0ade382f72ca to your computer and use it in GitHub Desktop.
Save pykong/7472e32b2483eea3d49d0ade382f72ca to your computer and use it in GitHub Desktop.
Important to prevent problems with saving tracked entity objects. https://visualstudiomagazine.com/blogs/tool-tracker/2013/11/updating--entities-with-automapper.aspx
// create new object
contact_existing = Mapper.Map<ContactDTO, Contact>(contact_dto);
// update existing object
contact_existing = Mapper.Map<ContactDTO, Contact>(contact_dto, contact_existing);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment