@@ -15,13 +15,13 @@ namespace Microsoft.Data.ProviderBase
15
15
using System . Threading . Tasks ;
16
16
using Microsoft . Data . Common ;
17
17
using Microsoft . Data . SqlClient ;
18
- using SysTx = System . Transactions ;
18
+ using System . Transactions ;
19
19
20
20
internal abstract class DbConnectionInternal
21
21
{
22
22
private static int _objectTypeCount ;
23
23
internal readonly int _objectID = Interlocked . Increment ( ref _objectTypeCount ) ;
24
- private SysTx . TransactionCompletedEventHandler _transactionCompletedEventHandler = null ;
24
+ private TransactionCompletedEventHandler _transactionCompletedEventHandler = null ;
25
25
26
26
internal static readonly StateChangeEventArgs StateChangeClosed = new StateChangeEventArgs ( ConnectionState . Open , ConnectionState . Closed ) ;
27
27
internal static readonly StateChangeEventArgs StateChangeOpen = new StateChangeEventArgs ( ConnectionState . Closed , ConnectionState . Open ) ;
@@ -43,13 +43,13 @@ internal abstract class DbConnectionInternal
43
43
44
44
private DateTime _createTime ; // when the connection was created.
45
45
46
- private SysTx . Transaction _enlistedTransaction ; // [usage must be thread-safe] the transaction that we're enlisted in, either manually or automatically
46
+ private Transaction _enlistedTransaction ; // [usage must be thread-safe] the transaction that we're enlisted in, either manually or automatically
47
47
48
48
// _enlistedTransaction is a clone, so that transaction information can be queried even if the original transaction object is disposed.
49
49
// However, there are times when we need to know if the original transaction object was disposed, so we keep a reference to it here.
50
50
// This field should only be assigned a value at the same time _enlistedTransaction is updated.
51
51
// Also, this reference should not be disposed, since we aren't taking ownership of it.
52
- private SysTx . Transaction _enlistedTransactionOriginal ;
52
+ private Transaction _enlistedTransactionOriginal ;
53
53
54
54
#if DEBUG
55
55
private int _activateCount ; // debug only counter to verify activate/deactivates are in sync.
@@ -83,15 +83,15 @@ internal bool CanBePooled
83
83
}
84
84
}
85
85
86
- protected internal SysTx . Transaction EnlistedTransaction
86
+ protected internal Transaction EnlistedTransaction
87
87
{
88
88
get
89
89
{
90
90
return _enlistedTransaction ;
91
91
}
92
92
set
93
93
{
94
- SysTx . Transaction currentEnlistedTransaction = _enlistedTransaction ;
94
+ Transaction currentEnlistedTransaction = _enlistedTransaction ;
95
95
if ( ( ( null == currentEnlistedTransaction ) && ( null != value ) )
96
96
|| ( ( null != currentEnlistedTransaction ) && ! currentEnlistedTransaction . Equals ( value ) ) )
97
97
{ // WebData 20000024
@@ -104,8 +104,8 @@ protected internal SysTx.Transaction EnlistedTransaction
104
104
// SQLBUDT #230558 we need to use a clone of the transaction
105
105
// when we store it, or we'll end up keeping it past the
106
106
// duration of the using block of the TransactionScope
107
- SysTx . Transaction valueClone = null ;
108
- SysTx . Transaction previousTransactionClone = null ;
107
+ Transaction valueClone = null ;
108
+ Transaction previousTransactionClone = null ;
109
109
try
110
110
{
111
111
if ( null != value )
@@ -188,7 +188,7 @@ protected bool EnlistedTransactionDisposed
188
188
{
189
189
bool disposed ;
190
190
191
- SysTx . Transaction currentEnlistedTransactionOriginal = _enlistedTransactionOriginal ;
191
+ Transaction currentEnlistedTransactionOriginal = _enlistedTransactionOriginal ;
192
192
if ( currentEnlistedTransactionOriginal != null )
193
193
{
194
194
disposed = currentEnlistedTransactionOriginal . TransactionInformation == null ;
@@ -385,9 +385,9 @@ public ConnectionState State
385
385
386
386
internal virtual bool IsAccessTokenExpired => false ;
387
387
388
- abstract protected void Activate ( SysTx . Transaction transaction ) ;
388
+ abstract protected void Activate ( Transaction transaction ) ;
389
389
390
- internal void ActivateConnection ( SysTx . Transaction transaction )
390
+ internal void ActivateConnection ( Transaction transaction )
391
391
{
392
392
// Internal method called from the connection pooler so we don't expose
393
393
// the Activate method publicly.
@@ -415,7 +415,7 @@ internal void AddWeakReference(object value, int tag)
415
415
_referenceCollection . Add ( value , tag ) ;
416
416
}
417
417
418
- abstract public DbTransaction BeginTransaction ( IsolationLevel il ) ;
418
+ abstract public DbTransaction BeginTransaction ( System . Data . IsolationLevel il ) ;
419
419
420
420
virtual public void ChangeDatabase ( string value )
421
421
{
@@ -654,7 +654,7 @@ public virtual void Dispose()
654
654
// Dispose of the _enlistedTransaction since it is a clone
655
655
// of the original reference.
656
656
// VSDD 780271 - _enlistedTransaction can be changed by another thread (TX end event)
657
- SysTx . Transaction enlistedTransaction = Interlocked . Exchange ( ref _enlistedTransaction , null ) ;
657
+ Transaction enlistedTransaction = Interlocked . Exchange ( ref _enlistedTransaction , null ) ;
658
658
if ( enlistedTransaction != null )
659
659
{
660
660
enlistedTransaction . Dispose ( ) ;
@@ -681,7 +681,7 @@ protected internal void UnDoomThisConnection()
681
681
_connectionIsDoomed = false ;
682
682
}
683
683
684
- abstract public void EnlistTransaction ( SysTx . Transaction transaction ) ;
684
+ abstract public void EnlistTransaction ( Transaction transaction ) ;
685
685
686
686
virtual protected internal DataTable GetSchema ( DbConnectionFactory factory , DbConnectionPoolGroup poolGroup , DbConnection outerConnection , string collectionName , string [ ] restrictions )
687
687
{
@@ -865,21 +865,21 @@ internal void RemoveWeakReference(object value)
865
865
// Cleanup connection's transaction-specific structures (currently used by Delegated transaction).
866
866
// This is a separate method because cleanup can be triggered in multiple ways for a delegated
867
867
// transaction.
868
- virtual protected void CleanupTransactionOnCompletion ( SysTx . Transaction transaction )
868
+ virtual protected void CleanupTransactionOnCompletion ( Transaction transaction )
869
869
{
870
870
}
871
871
872
872
internal void DetachCurrentTransactionIfEnded ( )
873
873
{
874
- SysTx . Transaction enlistedTransaction = EnlistedTransaction ;
874
+ Transaction enlistedTransaction = EnlistedTransaction ;
875
875
if ( enlistedTransaction != null )
876
876
{
877
877
bool transactionIsDead ;
878
878
try
879
879
{
880
- transactionIsDead = ( SysTx . TransactionStatus . Active != enlistedTransaction . TransactionInformation . Status ) ;
880
+ transactionIsDead = ( TransactionStatus . Active != enlistedTransaction . TransactionInformation . Status ) ;
881
881
}
882
- catch ( SysTx . TransactionException )
882
+ catch ( TransactionException )
883
883
{
884
884
// If the transaction is being processed (i.e. is part way through a rollback\commit\etc then TransactionInformation.Status will throw an exception)
885
885
transactionIsDead = true ;
@@ -892,7 +892,7 @@ internal void DetachCurrentTransactionIfEnded()
892
892
}
893
893
894
894
// Detach transaction from connection.
895
- internal void DetachTransaction ( SysTx . Transaction transaction , bool isExplicitlyReleasing )
895
+ internal void DetachTransaction ( Transaction transaction , bool isExplicitlyReleasing )
896
896
{
897
897
SqlClientEventSource . Log . TryPoolerTraceEvent ( "<prov.DbConnectionInternal.DetachTransaction|RES|CPOOL> {0}, Transaction Completed. (pooledCount={1})" , ObjectID , _pooledCount ) ;
898
898
@@ -906,7 +906,7 @@ internal void DetachTransaction(SysTx.Transaction transaction, bool isExplicitly
906
906
DbConnection owner = Owner ;
907
907
if ( isExplicitlyReleasing || UnbindOnTransactionCompletion || owner is null )
908
908
{
909
- SysTx . Transaction currentEnlistedTransaction = _enlistedTransaction ;
909
+ Transaction currentEnlistedTransaction = _enlistedTransaction ;
910
910
if ( currentEnlistedTransaction != null && transaction . Equals ( currentEnlistedTransaction ) )
911
911
{
912
912
// We need to remove the transaction completed event handler to cease listening for the transaction to end.
@@ -924,7 +924,7 @@ internal void DetachTransaction(SysTx.Transaction transaction, bool isExplicitly
924
924
}
925
925
926
926
// Handle transaction detach, pool cleanup and other post-transaction cleanup tasks associated with
927
- internal void CleanupConnectionOnTransactionCompletion ( SysTx . Transaction transaction )
927
+ internal void CleanupConnectionOnTransactionCompletion ( Transaction transaction )
928
928
{
929
929
DetachTransaction ( transaction , false ) ;
930
930
@@ -935,9 +935,9 @@ internal void CleanupConnectionOnTransactionCompletion(SysTx.Transaction transac
935
935
}
936
936
}
937
937
938
- void TransactionCompletedEvent ( object sender , SysTx . TransactionEventArgs e )
938
+ void TransactionCompletedEvent ( object sender , TransactionEventArgs e )
939
939
{
940
- SysTx . Transaction transaction = e . Transaction ;
940
+ Transaction transaction = e . Transaction ;
941
941
SqlClientEventSource . Log . TryPoolerTraceEvent ( "<prov.DbConnectionInternal.TransactionCompletedEvent|RES|CPOOL> {0}, Transaction Completed. (pooledCount = {1})" , ObjectID , _pooledCount ) ;
942
942
943
943
CleanupTransactionOnCompletion ( transaction ) ;
@@ -947,9 +947,9 @@ void TransactionCompletedEvent(object sender, SysTx.TransactionEventArgs e)
947
947
948
948
// TODO: Review whether we need the unmanaged code permission when we have the new object model available.
949
949
[ SecurityPermission ( SecurityAction . Assert , Flags = SecurityPermissionFlag . UnmanagedCode ) ]
950
- private void TransactionOutcomeEnlist ( SysTx . Transaction transaction )
950
+ private void TransactionOutcomeEnlist ( Transaction transaction )
951
951
{
952
- _transactionCompletedEventHandler ??= new SysTx . TransactionCompletedEventHandler ( TransactionCompletedEvent ) ;
952
+ _transactionCompletedEventHandler ??= new TransactionCompletedEventHandler ( TransactionCompletedEvent ) ;
953
953
transaction . TransactionCompleted += _transactionCompletedEventHandler ;
954
954
}
955
955
0 commit comments