Skip to content

Conversation

@dshuvaev
Copy link
Contributor

Allowed several nested ambient transactions to be processed. Main scenario is when one transaction with TransactionScopeOption.RequiresNew is created inside another one. Thus when child transaction is complete its results are persisted, while parent transaction can be rejected.

Added resource string for further use to indicate that a parent transaction is completed before child one.
Allowed several nested ambient transactions to be processed. Main scenario is when one transaction with TransactionScopeOption.RequiresNew is created inside another one.
Added two unit tests to check nested ambient scenarios - one for normal flow when both transaction are committed, another for a case when child transaction is committed, and parent is not.
@dnfclas
Copy link

dnfclas commented Feb 21, 2020

CLA assistant check
All CLA requirements met.

@ajcvickers
Copy link
Contributor

@dshuvaev You need to sign the CLA before we can look at this PR.

@dshuvaev
Copy link
Contributor Author

@dshuvaev You need to sign the CLA before we can look at this PR.

I am getting approval to do so.

@dshuvaev
Copy link
Contributor Author

@dshuvaev You need to sign the CLA before we can look at this PR.

@ajcvickers It is signed. Thank you

EnlistedTransaction = null;
if (clearAmbient
&& _ambientTransaction != null)
if (clearAmbient && _ambientTransactions.Any())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_ambientTransactions.Count > 0

"Count" in this case works better than "Any"
@AndriySvyryd AndriySvyryd merged commit daa1ed2 into dotnet:master Feb 27, 2020
@AndriySvyryd
Copy link
Member

@dshuvaev Thanks for your contribution!

if (current == null)
{
Dependencies.TransactionLogger.AmbientTransactionWarning(this, DateTimeOffset.UtcNow);
var rootTransaction = _ambientTransactions.Any() && _ambientTransactions.TryPeek(out var transaction) ? transaction : null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could make count check.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants