diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2009-12-26 07:04:33 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2009-12-26 07:04:33 -0800 |
commit | 8a677d2d2320e96e4b70e994e978804a5cc358fc (patch) | |
tree | 25353095c2f3d5bbb940d47e8f612cafcdd4aa44 /projecttemplates/RelyingPartyLogic/Database.cs | |
parent | ce37861c9507e338fc81314898b3a30888310b55 (diff) | |
parent | 72f5ee12a341eaca93075fb0f4705bec7cc84631 (diff) | |
download | DotNetOpenAuth-8a677d2d2320e96e4b70e994e978804a5cc358fc.zip DotNetOpenAuth-8a677d2d2320e96e4b70e994e978804a5cc358fc.tar.gz DotNetOpenAuth-8a677d2d2320e96e4b70e994e978804a5cc358fc.tar.bz2 |
Merge branch 'reports' into v3.3
Conflicts:
projecttemplates/WebFormsRelyingParty/Web.config
src/DotNetOpenAuth/OpenId/RelyingParty/PositiveAnonymousResponse.cs
Diffstat (limited to 'projecttemplates/RelyingPartyLogic/Database.cs')
-rw-r--r-- | projecttemplates/RelyingPartyLogic/Database.cs | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/projecttemplates/RelyingPartyLogic/Database.cs b/projecttemplates/RelyingPartyLogic/Database.cs index 3dbb493..9ef72eb 100644 --- a/projecttemplates/RelyingPartyLogic/Database.cs +++ b/projecttemplates/RelyingPartyLogic/Database.cs @@ -51,7 +51,7 @@ namespace RelyingPartyLogic { throw; } - DataContextTransactionSimple = dataContext.Connection.BeginTransaction(); + DataContextTransaction = dataContext.Connection.BeginTransaction(); DataContextSimple = dataContext; } @@ -59,14 +59,14 @@ namespace RelyingPartyLogic { } } - private static DatabaseEntities DataContextSimple { + internal static IDbTransaction DataContextTransaction { get { if (HttpContext.Current != null) { - return HttpContext.Current.Items[DataContextKey] as DatabaseEntities; + return HttpContext.Current.Items[DataContextTransactionKey] as IDbTransaction; } else if (OperationContext.Current != null) { object data; - if (OperationContext.Current.IncomingMessageProperties.TryGetValue(DataContextKey, out data)) { - return data as DatabaseEntities; + if (OperationContext.Current.IncomingMessageProperties.TryGetValue(DataContextTransactionKey, out data)) { + return data as IDbTransaction; } else { return null; } @@ -75,25 +75,25 @@ namespace RelyingPartyLogic { } } - set { + private set { if (HttpContext.Current != null) { - HttpContext.Current.Items[DataContextKey] = value; + HttpContext.Current.Items[DataContextTransactionKey] = value; } else if (OperationContext.Current != null) { - OperationContext.Current.IncomingMessageProperties[DataContextKey] = value; + OperationContext.Current.IncomingMessageProperties[DataContextTransactionKey] = value; } else { throw new InvalidOperationException(); } } } - private static IDbTransaction DataContextTransactionSimple { + private static DatabaseEntities DataContextSimple { get { if (HttpContext.Current != null) { - return HttpContext.Current.Items[DataContextTransactionKey] as IDbTransaction; + return HttpContext.Current.Items[DataContextKey] as DatabaseEntities; } else if (OperationContext.Current != null) { object data; - if (OperationContext.Current.IncomingMessageProperties.TryGetValue(DataContextTransactionKey, out data)) { - return data as IDbTransaction; + if (OperationContext.Current.IncomingMessageProperties.TryGetValue(DataContextKey, out data)) { + return data as DatabaseEntities; } else { return null; } @@ -104,9 +104,9 @@ namespace RelyingPartyLogic { set { if (HttpContext.Current != null) { - HttpContext.Current.Items[DataContextTransactionKey] = value; + HttpContext.Current.Items[DataContextKey] = value; } else if (OperationContext.Current != null) { - OperationContext.Current.IncomingMessageProperties[DataContextTransactionKey] = value; + OperationContext.Current.IncomingMessageProperties[DataContextKey] = value; } else { throw new InvalidOperationException(); } @@ -126,10 +126,10 @@ namespace RelyingPartyLogic { } protected void Application_Error(object sender, EventArgs e) { - if (DataContextTransactionSimple != null) { - DataContextTransactionSimple.Rollback(); - DataContextTransactionSimple.Dispose(); - DataContextTransactionSimple = null; + if (DataContextTransaction != null) { + DataContextTransaction.Rollback(); + DataContextTransaction.Dispose(); + DataContextTransaction = null; } } @@ -137,9 +137,9 @@ namespace RelyingPartyLogic { var dataContext = DataContextSimple; if (dataContext != null) { dataContext.SaveChanges(); - if (DataContextTransactionSimple != null) { - DataContextTransactionSimple.Commit(); - DataContextTransactionSimple.Dispose(); + if (DataContextTransaction != null) { + DataContextTransaction.Commit(); + DataContextTransaction.Dispose(); } dataContext.Dispose(); |