Skip to content

Commit ef47d68

Browse files
committed
test
1 parent f6c2ff3 commit ef47d68

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/Ydb.Sdk/src/Ado/YdbCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ protected override async Task<DbDataReader> ExecuteDbDataReaderAsync(CommandBeha
210210
? new GrpcRequestSettings { TransportTimeout = TimeSpan.FromSeconds(CommandTimeout) }
211211
: new GrpcRequestSettings();
212212

213-
var transaction = YdbConnection.CurrentTransaction;
213+
var transaction = Transaction ?? YdbConnection.CurrentTransaction;
214214

215215
if (Transaction != null && Transaction != transaction)
216216
{

src/Ydb.Sdk/src/Ado/YdbConnection.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,17 @@ public YdbTransaction BeginTransaction(TransactionMode transactionMode = Transac
7272
if (CurrentTransaction is { Completed: false })
7373
{
7474
throw new InvalidOperationException(
75-
"A transaction is already in progress; nested/concurrent transactions aren't supported."
76-
);
75+
"A transaction is already in progress; nested/concurrent transactions aren't supported.");
76+
}
77+
78+
if (Session is ImplicitSession)
79+
{
80+
var driver = Session.Driver;
81+
Session.Dispose();
82+
83+
var factory = new PoolingSessionFactory(driver, ConnectionStringBuilder);
84+
var pooledSource = new PoolingSessionSource<PoolingSession>(factory, ConnectionStringBuilder);
85+
Session = pooledSource.OpenSession(CancellationToken.None).GetAwaiter().GetResult();
7786
}
7887

7988
CurrentTransaction = new YdbTransaction(this, transactionMode);

0 commit comments

Comments
 (0)