File tree Expand file tree Collapse file tree 1 file changed +25
-3
lines changed Expand file tree Collapse file tree 1 file changed +25
-3
lines changed Original file line number Diff line number Diff line change @@ -217,9 +217,31 @@ protected override async Task<DbDataReader> ExecuteDbDataReaderAsync(CommandBeha
217217 throw new InvalidOperationException ( "Transaction mismatched! (Maybe using another connection)" ) ;
218218 }
219219
220- var ydbDataReader = await YdbDataReader . CreateYdbDataReader ( await YdbConnection . Session . ExecuteQuery (
221- preparedSql . ToString ( ) , ydbParameters , execSettings , transaction ? . TransactionControl
222- ) , YdbConnection . OnNotSuccessStatusCode , transaction , cancellationToken ) ;
220+ var useImplicit = YdbConnection . EnableImplicitSession && transaction is null ;
221+ var session = YdbConnection . GetExecutionSession ( useImplicit ) ;
222+
223+ YdbDataReader ydbDataReader ;
224+ try
225+ {
226+ var execResult = await session . ExecuteQuery (
227+ preparedSql . ToString ( ) ,
228+ ydbParameters ,
229+ execSettings ,
230+ transaction ? . TransactionControl
231+ ) ;
232+
233+ ydbDataReader = await YdbDataReader . CreateYdbDataReader (
234+ execResult ,
235+ YdbConnection . OnNotSuccessStatusCode ,
236+ transaction ,
237+ cancellationToken
238+ ) ;
239+ }
240+ finally
241+ {
242+ if ( useImplicit )
243+ session . Close ( ) ;
244+ }
223245
224246 YdbConnection . LastReader = ydbDataReader ;
225247 YdbConnection . LastCommand = CommandText ;
You can’t perform that action at this time.
0 commit comments