Skip to content

Commit

Permalink
Fix | TransactionScope connection issue when Enlist is enable, Poolin…
Browse files Browse the repository at this point in the history
…g is disabled and network connection type is Redirect (#1960)
  • Loading branch information
lcheunglci committed Mar 23, 2023
1 parent 1bcdb23 commit 0c0ae37
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1235,7 +1235,7 @@ private void CompleteLogin(bool enlistOK)

// for non-pooled connections, enlist in a distributed transaction
// if present - and user specified to enlist
if (enlistOK && ConnectionOptions.Enlist)
if (enlistOK && ConnectionOptions.Enlist && RoutingInfo == null)
{
_parser._physicalStateObj.SniContext = SniContext.Snix_AutoEnlist;
Transaction tx = ADP.GetCurrentTransaction();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1500,7 +1500,7 @@ private void CompleteLogin(bool enlistOK)

// for non-pooled connections, enlist in a distributed transaction
// if present - and user specified to enlist
if (enlistOK && ConnectionOptions.Enlist)
if (enlistOK && ConnectionOptions.Enlist && _routingInfo == null)
{
_parser._physicalStateObj.SniContext = SniContext.Snix_AutoEnlist;
SysTx.Transaction tx = ADP.GetCurrentTransaction();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ public static class TransactionTest
public static void ReadNextQueryAfterTxAbortedPoolEnabled(string connString)
=> ReadNextQueryAfterTxAbortedTest(connString);

// Azure SQL has no DTC support
[ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup), nameof(DataTestUtility.IsNotAzureServer))]
[ConditionalTheory(typeof(DataTestUtility), nameof(DataTestUtility.AreConnStringsSetup))]
[MemberData(nameof(PoolDisabledConnectionStrings))]
public static void ReadNextQueryAfterTxAbortedPoolDisabled(string connString)
=> ReadNextQueryAfterTxAbortedTest(connString);
Expand Down

0 comments on commit 0c0ae37

Please sign in to comment.