Quantcast
Channel: entityframework Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1793

New Post: Issue 1043-Efficient API to ask if there are pending changes on a DbContext

$
0
0
Hi Unai,

Nice to hear from you on this so quickly :) We discussed this briefly and we came to some decisions (feel free to push back if you think these are wrong):"
  1. Name: HasChanges
  2. Location: ChangeTracker
  3. Return value: bool. The rationale for this has many parts:

    a. The name HasChanges suggests a bool value is returned
    b. The scenarios we have identified so far seem to work best (e.g. the code looks a bit nicer) with bool
    c. There are already more expensive ways of getting additional data for the different states if needed
    d. We can potentially create confusion if the numeric result from this API and SaveChanges didn't match
    e. Long term we don't necessarily want to go through the whole work that would require counting how many changes there are every time because the point is to be able to return something fast (I am not sure the implementation would do any less work anyway though)
  4. Behavior: it should respect the same contract with AutoDetectChanges as all the other APIs, e.g. the implementation should call InternalContext.DetectChanges() at the start.
  5. Method or read-only property: this is still a bit open but we are leaning towards method because it can potentially do a lot of work (e.g. if AutoDetectChanges == true)

Viewing all articles
Browse latest Browse all 1793

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>