I have this service which is Singleton and Single threaded and serves bunch of low volume clients. It uses Entity Framework and Data in SQL Server.
If any one of the client's request to Save Data fails, all the subsequent requests are being failed as every time it is trying to save the original failed data object.
Is there is any way to Undo changes to EF data when save fails?
Thanks in Advance
The Answer to the Question is "You Cannot discard Changes to the Context" instead one has to discard ObjectContext as Marc explained.
Entity-models / data-contexts / etc are best handled as units of work. If you need to cancel it, simply discard the context and start with a new one. And if you succeed, discard it anyway! Each request should really be using separate data-contexts, otherwise you can get a range of problems: