Skip to content

Commit

Permalink
[5.1.1] Fix | TransactionScope connection issue when Enlist is enable…
Browse files Browse the repository at this point in the history
…, Pooling is disabled and network connection type is Redirect (#1967)
  • Loading branch information
lcheunglci authored Mar 27, 2023
1 parent 20e1535 commit daa1a74
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 daa1a74

Please sign in to comment.