1
- using System ;
1
+ using System ;
2
2
using System . Collections . Concurrent ;
3
3
using System . Transactions ;
4
4
using Xtensive . Core ;
5
- using Xtensive . Orm . Configuration ;
6
5
using SystemTransaction = System . Transactions . Transaction ;
7
6
8
7
namespace Xtensive . Orm . Reprocessing
@@ -56,21 +55,23 @@ public virtual T Execute<T>(ExecutionContext<T> context)
56
55
try {
57
56
T result ;
58
57
var disposeSession = false ;
59
- //SessionScope sessionScope = null;
60
58
try {
61
59
try {
62
60
var isolationLevel = context . IsolationLevel ;
63
61
var currentTransaction = SystemTransaction . Current ;
64
- if ( isolationLevel == IsolationLevel . Unspecified && currentTransaction != null )
62
+ if ( isolationLevel == IsolationLevel . Unspecified && currentTransaction != null ) {
65
63
isolationLevel = currentTransaction . IsolationLevel ;
64
+ }
65
+
66
66
session = context . ExternalSession ;
67
67
if ( session == null ) {
68
68
session = context . Domain . OpenSession ( ) ;
69
69
disposeSession = true ;
70
- //sessionScope = session.Activate();
71
70
}
72
- if ( currentTransaction != null && session . Transaction != null )
71
+ if ( currentTransaction != null && session . Transaction != null ) {
73
72
session . EnsureTransactionIsStarted ( ) ;
73
+ }
74
+
74
75
tran = ( currentTransaction != null && currentTransaction . TransactionInformation . DistributedIdentifier != Guid . Empty ) ||
75
76
( session . Transaction != null && session . Transaction . IsDisconnected )
76
77
? session . OpenTransaction ( isolationLevel )
@@ -85,7 +86,7 @@ public virtual T Execute<T>(ExecutionContext<T> context)
85
86
}
86
87
catch ( StorageException e ) {
87
88
if ( e . InnerException == null || ! ( e . InnerException is InvalidOperationException ) ||
88
- e . InnerException . Source != "System.Data" ) {
89
+ ! e . InnerException . Source . Equals ( "System.Data" , StringComparison . Ordinal ) ) {
89
90
throw ;
90
91
}
91
92
0 commit comments