I have a unique ObjectContext
, on which I perform a SaveChanges()
. This operation takes some time (~60 seconds).
This operation is executed in a thread.
My user have a "Cancel" button on the screen.
I'm able to stop the thread, but if theSaveChanges()
has already started I can't find anyway to cancel it.
In fact I found no way to access the underlying transaction (I also have an Isolation level issue : this operation locks almost all tables in database, so the application cannot be used by other users).
Would it work if I closed the underlying connection ? The EF won't be able to send a Rollback
instruction but I guess the database would perform it anyway, no ?
I've seen that I could use TransactionScope
but it needs to access DTC and my host 开发者_Go百科is not really performant when it comes to edit server/network configuration.
is your SaveChanges() saving multiple updates? Is it possible to update then save each individually?
Then, if you are inside a transaction, and user cancels, you'd have more granularity in your saves.
精彩评论