summaryrefslogtreecommitdiffstats
path: root/samples/OAuthServiceProvider/Code
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2011-06-09 17:14:03 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2011-06-09 17:14:03 -0700
commita921328045f5711fa4136a1f57d5db4745117905 (patch)
treefe2d7cfa663bdd22d4a85f3b19f9a66636610763 /samples/OAuthServiceProvider/Code
parent2751e08721af51437ae5738e2da23dd460df6cc8 (diff)
parentd916633668329aa07f0b6f2ee952268a5dff8069 (diff)
downloadDotNetOpenAuth-a921328045f5711fa4136a1f57d5db4745117905.zip
DotNetOpenAuth-a921328045f5711fa4136a1f57d5db4745117905.tar.gz
DotNetOpenAuth-a921328045f5711fa4136a1f57d5db4745117905.tar.bz2
Merge branch 'v3.4' into sample2legged
Diffstat (limited to 'samples/OAuthServiceProvider/Code')
-rw-r--r--samples/OAuthServiceProvider/Code/Global.cs9
1 files changed, 9 insertions, 0 deletions
diff --git a/samples/OAuthServiceProvider/Code/Global.cs b/samples/OAuthServiceProvider/Code/Global.cs
index ceaeac8..60fed9f 100644
--- a/samples/OAuthServiceProvider/Code/Global.cs
+++ b/samples/OAuthServiceProvider/Code/Global.cs
@@ -117,6 +117,15 @@
private void Application_Error(object sender, EventArgs e) {
Logger.Error("An unhandled exception occurred in ASP.NET processing: " + Server.GetLastError(), Server.GetLastError());
+
+ // In the event of an unhandled exception, reverse any changes that were made to the database to avoid any partial database updates.
+ var dataContext = dataContextSimple;
+ if (dataContext != null) {
+ dataContext.Transaction.Rollback();
+ dataContext.Connection.Close();
+ dataContext.Dispose();
+ dataContextSimple = null;
+ }
}
private void Application_EndRequest(object sender, EventArgs e) {