Entity Framework graph merge extension method
Switch branches/tags
Nothing to show
Clone or download
Latest commit a3e7b13 Apr 23, 2018
Failed to load latest commit information.
GraphDiff Fix issue with class inside class Dec 16, 2017
docs Update index.md Apr 23, 2018
.gitignore Fix issue with class inside class Dec 16, 2017
LICENSE Update LICENSE Oct 23, 2013
README.md Update README.md Jun 10, 2014



DbContext extension methods for Entity Framework Code First, that allow you to save an entire detached Model/Entity, with child Entities and Lists, to the database without writing the code to do it.

This version is for EF6+. If you would like to use the project on EF(4.3,5.0) see this branch https://github.com/refactorthis/GraphDiff/tree/EF4-5.

Please see the initial post @ http://blog.brentmckendrick.com/introducing-graphdiff-for-entity-framework-code-first-allowing-automated-updates-of-a-graph-of-detached-entities/ for more information.

Nuget package is at http://nuget.org/packages/RefactorThis.GraphDiff/


  • Merge an entire graph of detached entities to the database using DbContext.UpdateGraph();
  • Ensures concurrency is maintained for all child entities in the graph
  • Allows for different configuration mappings to ensure that only changes within the defined graph are persisted
  • Comprehensive testing suite to cover many (un/)common scenarios.

Proposed Features

  • Fluent API style mapping of aggregates on bootstrapping
  • Retrieve an aggregate from the database without specifying include expressions
  • Define the aggregate using attributes on the models
  • Allow for the initial db query to be performed as multiple queries where needed (too many includes, etc)

Release Notes


  • Rewrite of graph traversal code and rewrite of tests to cover more scenarios.
  • multiple bug fixes


Brent McKendrick, Andreas Pelzer


See the LICENSE file for license rights and limitations (MIT).