Skip to content

Instantly share code, notes, and snippets.

@jameshulse
Last active December 16, 2015 14:10
Show Gist options
  • Save jameshulse/feae2c0db83f9a32fb2d to your computer and use it in GitHub Desktop.
Save jameshulse/feae2c0db83f9a32fb2d to your computer and use it in GitHub Desktop.
Example Automapper API to determine changes made from mapping
var person = new Person(name: "James", age: 27);
var update = new PersonUpdate { age = 28 };
var changes = Map.MapWithChanges(update, person); // Theoretical API
if(changes.Any())
_db.Save(person);
@jameshulse
Copy link
Author

As opposed to:

if(person.Name != originalName || person.Age != originalAge)
    _db.Save(person);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment