1- using System ;
1+ using System ;
22using System . Collections . Concurrent ;
33using System . Transactions ;
44using Xtensive . Core ;
5- using Xtensive . Orm . Configuration ;
65using SystemTransaction = System . Transactions . Transaction ;
76
87namespace Xtensive . Orm . Reprocessing
@@ -56,21 +55,23 @@ public virtual T Execute<T>(ExecutionContext<T> context)
5655 try {
5756 T result ;
5857 var disposeSession = false ;
59- //SessionScope sessionScope = null;
6058 try {
6159 try {
6260 var isolationLevel = context . IsolationLevel ;
6361 var currentTransaction = SystemTransaction . Current ;
64- if ( isolationLevel == IsolationLevel . Unspecified && currentTransaction != null )
62+ if ( isolationLevel == IsolationLevel . Unspecified && currentTransaction != null ) {
6563 isolationLevel = currentTransaction . IsolationLevel ;
64+ }
65+
6666 session = context . ExternalSession ;
6767 if ( session == null ) {
6868 session = context . Domain . OpenSession ( ) ;
6969 disposeSession = true ;
70- //sessionScope = session.Activate();
7170 }
72- if ( currentTransaction != null && session . Transaction != null )
71+ if ( currentTransaction != null && session . Transaction != null ) {
7372 session . EnsureTransactionIsStarted ( ) ;
73+ }
74+
7475 tran = ( currentTransaction != null && currentTransaction . TransactionInformation . DistributedIdentifier != Guid . Empty ) ||
7576 ( session . Transaction != null && session . Transaction . IsDisconnected )
7677 ? session . OpenTransaction ( isolationLevel )
@@ -85,7 +86,7 @@ public virtual T Execute<T>(ExecutionContext<T> context)
8586 }
8687 catch ( StorageException e ) {
8788 if ( e . InnerException == null || ! ( e . InnerException is InvalidOperationException ) ||
88- e . InnerException . Source != "System.Data" ) {
89+ ! e . InnerException . Source . Equals ( "System.Data" , StringComparison . Ordinal ) ) {
8990 throw ;
9091 }
9192
0 commit comments