Skip to content

Commit 940741b

Browse files
committed
Merge branch 'master' into master-connection-handlers
2 parents 31b15a3 + 9b13eae commit 940741b

File tree

24 files changed

+590
-654
lines changed

24 files changed

+590
-654
lines changed

Orm/Xtensive.Orm.SqlServer/Sql.Drivers.SqlServer/Connection.cs

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -118,40 +118,6 @@ public override void BeginTransaction(IsolationLevel isolationLevel)
118118
activeTransaction = underlyingConnection.BeginTransaction(isolationLevel);
119119
}
120120

121-
/// <inheritdoc/>
122-
public override void Commit()
123-
{
124-
EnsureIsNotDisposed();
125-
EnsureTransactionIsActive();
126-
127-
try {
128-
if (!IsTransactionZombied()) {
129-
ActiveTransaction.Commit();
130-
}
131-
}
132-
finally {
133-
ActiveTransaction.Dispose();
134-
ClearActiveTransaction();
135-
}
136-
}
137-
138-
/// <inheritdoc/>
139-
public override async Task CommitAsync(CancellationToken token = default)
140-
{
141-
EnsureIsNotDisposed();
142-
EnsureTransactionIsActive();
143-
144-
try {
145-
if (!IsTransactionZombied()) {
146-
await ActiveTransaction.CommitAsync(token).ConfigureAwait(false);
147-
}
148-
}
149-
finally {
150-
await ActiveTransaction.DisposeAsync().ConfigureAwait(false);
151-
ClearActiveTransaction();
152-
}
153-
}
154-
155121
/// <inheritdoc/>
156122
public override void Rollback()
157123
{

Orm/Xtensive.Orm.Tests/Storage/NestedTransactionsTest.cs

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// Copyright (C) 2003-2010 Xtensive LLC.
2-
// All rights reserved.
3-
// For conditions of distribution and use, see license.
1+
// Copyright (C) 2009-2021 Xtensive LLC.
2+
// This code is distributed under MIT license terms.
3+
// See the License.txt file in the project root for more information.
44
// Created by: Denis Krjuchkov
55
// Created: 2009.11.26
66

@@ -159,25 +159,30 @@ public void RollbackNestedTransactionWithActiveEnumeratorTest()
159159
public void RollbackNestedTransactionWithActiveEnumeratorAndThenCompleteOutermostTest()
160160
{
161161
var session = Session.Demand();
162-
using (var outerTx = session.OpenTransaction()) {
163-
_ = new Hexagon();
164-
_ = new Hexagon();
165-
_ = new Hexagon();
162+
var outerTx = session.OpenTransaction();
163+
_ = new Hexagon();
164+
_ = new Hexagon();
165+
_ = new Hexagon();
166166

167-
IEnumerator<int> enumerator = null;
168-
var innerTx = session.OpenTransaction(TransactionOpenMode.New);
167+
IEnumerator<int> enumerator = null;
168+
var innerTx = session.OpenTransaction(TransactionOpenMode.New);
169169

170-
enumerator = session.Query.All<Hexagon>()
171-
.Select(item => item.Id).AsEnumerable().GetEnumerator();
172-
_ = enumerator.MoveNext();
170+
enumerator = session.Query.All<Hexagon>()
171+
.Select(item => item.Id).AsEnumerable().GetEnumerator();
172+
_ = enumerator.MoveNext();
173173

174-
if (storageProviderInfo.CheckProviderIs(StorageProvider.SqlServer)) {
175-
_ = Assert.Throws<StorageException>(() => innerTx.Dispose());
176-
}
177-
else {
178-
Assert.DoesNotThrow(() => innerTx.Dispose());
179-
}
180-
outerTx.Complete();
174+
if (storageProviderInfo.CheckProviderIs(StorageProvider.SqlServer)) {
175+
_ = Assert.Throws<StorageException>(() => innerTx.Dispose());
176+
}
177+
else {
178+
Assert.DoesNotThrow(() => innerTx.Dispose());
179+
}
180+
outerTx.Complete();
181+
if (storageProviderInfo.CheckProviderIs(StorageProvider.SqlServer)) {
182+
_ = Assert.Throws<StorageException>(() => outerTx.Dispose());
183+
}
184+
else {
185+
Assert.DoesNotThrow(() => outerTx.Dispose());
181186
}
182187
}
183188

0 commit comments

Comments
 (0)