diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-01-01 19:04:55 -0800 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-01-01 19:04:55 -0800 |
commit | 6805d02a0e5d480b8546698e01feaadef3a936c5 (patch) | |
tree | bc08848a0df8a51872136d287c982bbf5159dbf6 /projecttemplates/RelyingPartyLogic/Database.cs | |
parent | 70446775807fde815cc1885f6f0fa75a79b861ac (diff) | |
download | DotNetOpenAuth-6805d02a0e5d480b8546698e01feaadef3a936c5.zip DotNetOpenAuth-6805d02a0e5d480b8546698e01feaadef3a936c5.tar.gz DotNetOpenAuth-6805d02a0e5d480b8546698e01feaadef3a936c5.tar.bz2 |
Fixed intermittent error while executing SQL stored procedures.
Diffstat (limited to 'projecttemplates/RelyingPartyLogic/Database.cs')
-rw-r--r-- | projecttemplates/RelyingPartyLogic/Database.cs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/projecttemplates/RelyingPartyLogic/Database.cs b/projecttemplates/RelyingPartyLogic/Database.cs index 9ef72eb..d7efeac 100644 --- a/projecttemplates/RelyingPartyLogic/Database.cs +++ b/projecttemplates/RelyingPartyLogic/Database.cs @@ -8,6 +8,7 @@ namespace RelyingPartyLogic { using System; using System.Collections.Generic; using System.Data; + using System.Data.EntityClient; using System.Data.SqlClient; using System.Linq; using System.ServiceModel; @@ -51,7 +52,7 @@ namespace RelyingPartyLogic { throw; } - DataContextTransaction = dataContext.Connection.BeginTransaction(); + DataContextTransaction = (EntityTransaction)dataContext.Connection.BeginTransaction(); DataContextSimple = dataContext; } @@ -59,14 +60,21 @@ namespace RelyingPartyLogic { } } - internal static IDbTransaction DataContextTransaction { + /// <summary> + /// Gets a value indicating whether the data context is already initialized. + /// </summary> + internal static bool IsDataContextInitialized { + get { return DataContextSimple != null; } + } + + internal static EntityTransaction DataContextTransaction { get { if (HttpContext.Current != null) { - return HttpContext.Current.Items[DataContextTransactionKey] as IDbTransaction; + return HttpContext.Current.Items[DataContextTransactionKey] as EntityTransaction; } else if (OperationContext.Current != null) { object data; if (OperationContext.Current.IncomingMessageProperties.TryGetValue(DataContextTransactionKey, out data)) { - return data as IDbTransaction; + return data as EntityTransaction; } else { return null; } |