-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User message for non-support of Sys.Transactions in SqlClient #21765
Comments
One of the proposal I make, is to Check in SqlClient operations (SqlConnection.Open() , SqlCommand.Execute*() ) to see if there is an active transaction scope and show an error to the customer that they are trying to use TransactionScope with SqlClient which is not supported and the implicit Transactional behavior is not guaranteed. This proposal would make the customer opt-in to use SqlClient operations in TransactionScope, knowing that the implicit transactions enlisting is not supported. The AppConfig switch will be removed once we add the Sys.Transactions support in SqlClient. |
cc @karelz @FransBouma @NickCraver @divega @danmosemsft |
AFAIR, auto-enlistment only happens during We can also override FWIW, we are already doing something similar in EF Core layer, and the plan is to remove it when we have actual support. |
Makes sense. Essentially we are down to throwing an exception for
@divega For dotnet/corefx#1 do you think that it makes sense to have an opt-in behavior with an AppCompat switch to disable the exception so that the customer uses the feature after knowing that its risks? |
@saurabh500 I have a concern with having a temporary flag that just bypasses the exception: assume once we start supporting Sys.Tx again, we stop paying attention to this flag and connections are auto-enlisted again. This will have significant side effects on the behavior of the app, but can easily go undetected. It seems much better to tell users to disable auto-enlistment in the connection string to avoid the exception. Then they can choose to opt back in (or not) once we have the support added. |
@divega Thanks for the feedback. I had missed out the fact that I can re-introduce the Enlist keyword and take a decision based on the keyword along with a current transaction in |
I am opening this issue to discuss the right customer messaging for absence of Sys.Transactions support in SqlClient.
Refer comment https://github.com/dotnet/corefx/issues/19708#issuecomment-301959886 and the following comment.
In case of SqlClient operations enclosed in a TransactionScope, the operations would not be run in a single transaction.
However this would not throw an exception to the customer. We need a mechanism to make sure that customers understand this behavior.
The text was updated successfully, but these errors were encountered: