Support System.Transactions in SqlClient for .NET Core
Given System.Transactions is going to be included in 1.2 (see https://github.com/dotnet/corefx/issues/2949) the next step seems to be to bring auto-enlistment of ambient transactions and related behaviors into the .NET Core version of SqlClient.
Note that the corresponding EF Core feature (tracked at https://github.com/aspnet/EntityFramework/issues/5595) will depend on this to work with SQL Server.
Does SqlClient support some functionality such as EnlistTransaction for System.Transactions on .net core? There is a user reporting not able to use SqlConnection with System.Transactions on .net core. Please share current status and plan for supporting System.Transactions in SqlClient on .net core.
The development of the feature is underway. Right now we don't support EnlistTransaction or any API related to System.Transactions in SqlClient.
OK. I can live without Ambient Transactions, but are you saying that we can't even use explicit Transactions? How are you supposed to do anything remotely serious with SQL without Transactions?
@DRAirey1 you can use DbTransaction APIs with SqlClient to manage transactions. System.Transactions cannot be used with SqlClient in 4.4.0
@geleems can we close this issue now that you have pushed your changes for ambient transactions and related APIs?
How does this work with an n-Tier design? That is, how do I create a transaction that commits to my in-memory model and my persistent store (SQL Server) as an atomic action? I don't see how I do this with an SqlTransaction.
Ambient Transaction and Transaction related APIs were ported from Framework: https://github.com/dotnet/corefx/pull/22059
Yes. I see the Transactions. Yes. I see the SqlClient library. No, I can't get them to work together like they do in .NET Framework 4.7. I get 'Enlisting in Ambient transactions is not supported' when I try to execute EnlistTransaction(
I don't need Ambient Transactions, but I need some mechanism to make sure that my in-memory update and my SQL update are committed as a unit. If there's some new library or paradigm, I'm happy to look at it.