Skip to content

Multiple Sqlconnections with Same connectionstring enlisting into distributed transaction #13

@Petermarcu

Description

@Petermarcu

@leo12chandu commented on Fri Aug 24 2018

Issue Title

Multiple Sqlconnections with Same connectionstring enlisting into distributed transaction.

General

When I open 2 SqlConnections as below and enlist each of them in the same committable transaction, it enlists as a distributed transaction. I would've thought if its the same connection string, we don't need to enlist as distributed transaction.

As a side note, distributed transactions are not supported in .NET Core as of 2.1. they seem to throw PlatformNotSupportedException(). Do you have plans of providing something similar to MSDTC in the future that works on linux boxes too? or is there other recommendations for alternatives to MSDTC to run with distributed transactions in .net core?

Code to reproduce:-

 TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.MaximumTimeout;

            var tran = CommittableTransaction(options);
            using (SqlConnection connection = GetSqlConnection("cn1"))
            {
                connection.Open();
                connection.EnlistTransaction(tran);
            }
            using (SqlConnection connection = GetSqlConnection("cn1"))
            {
                connection.Open();
                connection.EnlistTransaction(tran);
            }
            tran.Commit();

Metadata

Metadata

Assignees

No one assigned

    Labels

    By Design 🎨Issues due to driver feature design and will not be fixed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions