Skip to content
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

Allow to disable auto-transactions for stored procedures mapped to CUD operations #28511

Open
Tracked by #22959 ...
AndriySvyryd opened this issue Jul 25, 2022 · 2 comments

Comments

@AndriySvyryd
Copy link
Member

Some sprocs cannot be executed in a transaction. These need a configuration flag that will affect SaveChanges and the execution strategy.

Current workaround is to use a transaction interceptor.

Split off from #245

@roji
Copy link
Member

roji commented Jul 25, 2022

Another possible workaround would be to set AutoTransactionsEnabled=false, disabling the transaction for the entire SaveChanges.

@ajcvickers ajcvickers added this to the Backlog milestone Jul 28, 2022
@roji
Copy link
Member

roji commented Aug 15, 2022

#28711 is replacing AutoTransactionsEnable with a 3-value enum (WhenNeeded, Always, Never), @AndriySvyryd suggested adding a WhenNotInvokingStoredProcedure for this. Some possible drawbacks:

  • We discussed possibly only exempting the specific sproc from the transaction in the batch, i.e. wrapping all the other modification commands in transactions, before and after.
    • If we do this, we need specific metadata on the sproc rather than a global AutoTransactionBehavior setting.
    • This is maybe of somewhat limited value, because if there's a failure there's still the possibility of inconsistency. This would only reduce the change of an inconsistency (i.e. only if the failure occurs occurs inside or after the sproc).
  • This would require users to manually set AutoTransactionBehavior everywhere where the specific sproc is being used. Specifying this once in metadata would be a better user experience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants