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 the SaveChanges()
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 is 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 is not really performant when it comes to edit server/network configuration.
So if a "Entity Framework" solution exist I'd prefer that one.