Resubmitting Changes?
If I want to resubmit changes, do I have to redefine them after making my first submit, or can I simply call the SubmitChanges() method again as in the following code:
DB.SubmitChanges();
Thread.Sleep(1000);
DB.SubmitChanges();
Edit: The reason why I want to do this is because I have two different linq queries that handle conflicts using RefreshMode.OverwriteCurrentValues. One of the queries is more important than the other, and in order to trump the other, my best idea (and it's not great I admit) is to just wait a while and resu开发者_如何转开发bmit the changes.
If DB.SubmitChanges returns without throwing an exception - it thinks that the database now has the changes. It still is tracking the "changed" values, but they are tracked as unchanged and will not be resubmitted.
If DB.SubmitChanges throws, then it thinks that none of the changes made it to the database. In that case, the "changed" values are still tracked as changed and calling DB.SubmitChanges again will attempt to make those same changes. You may want to resolve optimistic concurrency conflicts before doing this second call.
精彩评论