@@ -43,7 +43,7 @@ private async Task<MySqlTransaction> BeginDbTransactionAsync(IsolationLevel isol
43
43
if ( CurrentTransaction != null )
44
44
throw new InvalidOperationException ( "Transactions may not be nested." ) ;
45
45
#if ! NETSTANDARD1_3
46
- if ( m_implicitTransaction != null )
46
+ if ( m_enlistedTransaction != null )
47
47
throw new InvalidOperationException ( "Cannot begin a transaction when already enlisted in a transaction." ) ;
48
48
#endif
49
49
@@ -86,10 +86,10 @@ private async Task<MySqlTransaction> BeginDbTransactionAsync(IsolationLevel isol
86
86
public override void EnlistTransaction ( System . Transactions . Transaction transaction )
87
87
{
88
88
// ignore reenlistment of same connection in same transaction
89
- if ( m_implicitTransaction ? . Transaction . Equals ( transaction ) ?? false )
89
+ if ( m_enlistedTransaction ? . Transaction . Equals ( transaction ) ?? false )
90
90
return ;
91
91
92
- if ( m_implicitTransaction != null )
92
+ if ( m_enlistedTransaction != null )
93
93
throw new MySqlException ( "Already enlisted in a Transaction." ) ;
94
94
if ( CurrentTransaction != null )
95
95
throw new InvalidOperationException ( "Can't enlist in a Transaction when there is an active MySqlTransaction." ) ;
@@ -106,25 +106,25 @@ public override void EnlistTransaction(System.Transactions.Transaction transacti
106
106
}
107
107
else
108
108
{
109
- m_implicitTransaction = m_connectionSettings . UseXaTransactions ?
110
- ( ImplicitTransactionBase ) new XaImplicitTransaction ( transaction , this ) :
111
- new StandardImplicitTransaction ( transaction , this ) ;
112
- m_implicitTransaction . Start ( ) ;
109
+ m_enlistedTransaction = m_connectionSettings . UseXaTransactions ?
110
+ ( EnlistedTransactionBase ) new XaEnlistedTransaction ( transaction , this ) :
111
+ new StandardEnlistedTransaction ( transaction , this ) ;
112
+ m_enlistedTransaction . Start ( ) ;
113
113
114
114
lock ( s_lock )
115
115
{
116
116
if ( ! s_transactionConnections . TryGetValue ( transaction , out var enlistedTransactions ) )
117
- s_transactionConnections [ transaction ] = enlistedTransactions = new List < ImplicitTransactionBase > ( ) ;
118
- enlistedTransactions . Add ( m_implicitTransaction ) ;
117
+ s_transactionConnections [ transaction ] = enlistedTransactions = new List < EnlistedTransactionBase > ( ) ;
118
+ enlistedTransactions . Add ( m_enlistedTransaction ) ;
119
119
}
120
120
}
121
121
}
122
122
}
123
123
124
124
internal void UnenlistTransaction ( )
125
125
{
126
- var transaction = m_implicitTransaction . Transaction ;
127
- m_implicitTransaction = null ;
126
+ var transaction = m_enlistedTransaction . Transaction ;
127
+ m_enlistedTransaction = null ;
128
128
129
129
// find this connection in the list of connections associated with the transaction
130
130
bool ? wasIdle = null ;
@@ -201,9 +201,9 @@ private void TakeSessionFrom(MySqlConnection other)
201
201
throw new InvalidOperationException ( "This connection must not have a session" ) ;
202
202
if ( other . m_session is null )
203
203
throw new InvalidOperationException ( "Other connection must have a session" ) ;
204
- if ( m_implicitTransaction != null )
204
+ if ( m_enlistedTransaction != null )
205
205
throw new InvalidOperationException ( "This connection must not have an enlisted transaction" ) ;
206
- if ( other . m_implicitTransaction is null )
206
+ if ( other . m_enlistedTransaction is null )
207
207
throw new InvalidOperationException ( "Other connection must have an enlisted transaction" ) ;
208
208
if ( m_activeReader != null )
209
209
throw new InvalidOperationException ( "This connection must not have an active reader" ) ;
@@ -218,11 +218,11 @@ private void TakeSessionFrom(MySqlConnection other)
218
218
m_cachedProcedures = other . m_cachedProcedures ;
219
219
other . m_cachedProcedures = null ;
220
220
221
- m_implicitTransaction = other . m_implicitTransaction ;
222
- other . m_implicitTransaction = null ;
221
+ m_enlistedTransaction = other . m_enlistedTransaction ;
222
+ other . m_enlistedTransaction = null ;
223
223
}
224
224
225
- ImplicitTransactionBase m_implicitTransaction ;
225
+ EnlistedTransactionBase m_enlistedTransaction ;
226
226
#endif
227
227
228
228
public override void Close ( ) => DoClose ( changeState : true ) ;
@@ -523,7 +523,7 @@ internal async Task<CachedProcedure> GetCachedProcedure(IOBehavior ioBehavior, s
523
523
#if NETSTANDARD1_3
524
524
internal bool IgnoreCommandTransaction => m_connectionSettings . IgnoreCommandTransaction ;
525
525
#else
526
- internal bool IgnoreCommandTransaction => m_connectionSettings . IgnoreCommandTransaction || m_implicitTransaction is StandardImplicitTransaction ;
526
+ internal bool IgnoreCommandTransaction => m_connectionSettings . IgnoreCommandTransaction || m_enlistedTransaction is StandardEnlistedTransaction ;
527
527
#endif
528
528
internal bool IgnorePrepare => m_connectionSettings . IgnorePrepare ;
529
529
internal bool TreatTinyAsBoolean => m_connectionSettings . TreatTinyAsBoolean ;
@@ -642,7 +642,7 @@ private void DoClose(bool changeState)
642
642
#if ! NETSTANDARD1_3
643
643
// If participating in a distributed transaction, keep the connection open so we can commit or rollback.
644
644
// This handles the common pattern of disposing a connection before disposing a TransactionScope (e.g., nested using blocks)
645
- if ( ! ( m_implicitTransaction is null ) )
645
+ if ( ! ( m_enlistedTransaction is null ) )
646
646
{
647
647
// make sure all DB work is done
648
648
m_activeReader ? . Dispose ( ) ;
@@ -663,7 +663,7 @@ private void DoClose(bool changeState)
663
663
// put the new, idle, connection into the list of sessions for this transaction (replacing this MySqlConnection)
664
664
lock ( s_lock )
665
665
{
666
- foreach ( var enlistedTransaction in s_transactionConnections [ connection . m_implicitTransaction . Transaction ] )
666
+ foreach ( var enlistedTransaction in s_transactionConnections [ connection . m_enlistedTransaction . Transaction ] )
667
667
{
668
668
if ( enlistedTransaction . Connection == this )
669
669
{
@@ -727,7 +727,7 @@ private ConnectionSettings GetConnectionSettings()
727
727
static readonly StateChangeEventArgs s_stateChangeOpenClosed = new StateChangeEventArgs ( ConnectionState . Open , ConnectionState . Closed ) ;
728
728
#if ! NETSTANDARD1_3
729
729
static readonly object s_lock = new object ( ) ;
730
- static readonly Dictionary < System . Transactions . Transaction , List < ImplicitTransactionBase > > s_transactionConnections = new Dictionary < System . Transactions . Transaction , List < ImplicitTransactionBase > > ( ) ;
730
+ static readonly Dictionary < System . Transactions . Transaction , List < EnlistedTransactionBase > > s_transactionConnections = new Dictionary < System . Transactions . Transaction , List < EnlistedTransactionBase > > ( ) ;
731
731
#endif
732
732
733
733
string m_connectionString ;
0 commit comments