zzzprojects / GraphDiff

GraphDiff is a library that allows the automatic update of a detached graph using Entity Framework code first.
https://entityframework-graphdiff.net/overview
MIT License
333 stars 101 forks source link

Used cached entity for comparison #141

Open bzuillsmith opened 9 years ago

bzuillsmith commented 9 years ago

I can sometimes cache the unchanged state of an entity from the db. I tried attaching it to the context just before UpdateChanges but GraphDiff still queries the db. How would I make GraphDiff use the attached version instead of requerying it from the db?

sundeepyama commented 9 years ago

Hi bzuillsmith

You can pass the persisted entity from the db to Merge method in GraphDiffer.cs file.

See the highlighted section in the below image. If you pass in the persisted object which is attached to context then GraphDiff shouldn't query again.

image

bzuillsmith commented 9 years ago

Indeed. Except that GraphDiffer is internal. So it would require modifying some other files as well. I may put the effort into a pull request if it seems like a reasonable solution to @refactorthis