File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff 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 {
Original file line number Diff line number Diff 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 ) ;
You can’t perform that action at this time.
0 commit comments