Reputation: 7254
let's suppose the situation looks like this: I have one object context in my app and I download 15k records from the db (like 15k invoices). User picks one and makes some changes to it. I call SaveChanges() and it fails for some reason (doesn't matter what reason).
Now the context that was used can't perform any save because it wasn't able to save those changes. What should I do to make it work?
Another scenario is that I use a separate context for making changes. If saving fails then nothing happens - I discard the context and that's it. The problem that arises is: how to merge changes back to the main context? (without downloading 15k records once again)
Upvotes: 1
Views: 102
Reputation: 364279
Idea of downloading 15k records smells pretty bad but lets assume you must do it. The scenario you must follow to make this work should look like:
NoTracking
(MergeOption
of ObjectQuery
)! It will improve performance because these records will never be used in context again.Upvotes: 3