File tree Expand file tree Collapse file tree 3 files changed +18
-19
lines changed Expand file tree Collapse file tree 3 files changed +18
-19
lines changed Original file line number Diff line number Diff line change @@ -35,11 +35,18 @@ CancellationToken cancellationToken
3535 : Drivers [ settings . GrpcConnectionString ] = await settings . BuildDriver ( ) ;
3636 driver . RegisterOwner ( ) ;
3737
38- var factory = new PoolingSessionFactory ( driver , settings ) ;
39- var newSessionPool = new PoolingSessionSource < PoolingSession > ( factory , settings ) ;
38+ ISessionSource newSessionPool ;
39+ if ( settings . EnableImplicitSession )
40+ {
41+ newSessionPool = new ImplicitSessionSource ( driver ) ;
42+ }
43+ else
44+ {
45+ var factory = new PoolingSessionFactory ( driver , settings ) ;
46+ newSessionPool = new PoolingSessionSource < PoolingSession > ( factory , settings ) ;
47+ }
4048
4149 Pools [ settings . ConnectionString ] = newSessionPool ;
42-
4350 return newSessionPool ;
4451 }
4552 finally
Original file line number Diff line number Diff line change @@ -9,11 +9,11 @@ internal sealed class ImplicitSession : ISession
99 private int _disposed ;
1010
1111 public ImplicitSession ( IDriver driver )
12+ : this ( driver , owner : null )
1213 {
13- Driver = driver ;
1414 }
1515
16- public ImplicitSession ( IDriver driver , ImplicitSessionSource owner )
16+ public ImplicitSession ( IDriver driver , ImplicitSessionSource ? owner )
1717 {
1818 Driver = driver ;
1919 _owner = owner ;
@@ -34,10 +34,10 @@ public ValueTask<IServerStream<ExecuteQueryResponsePart>> ExecuteQuery(
3434
3535 var request = new ExecuteQueryRequest
3636 {
37- ExecMode = ExecMode . Execute ,
37+ ExecMode = ExecMode . Execute ,
3838 QueryContent = new QueryContent { Text = query , Syntax = Syntax . YqlV1 } ,
39- StatsMode = StatsMode . None ,
40- TxControl = txControl
39+ StatsMode = StatsMode . None ,
40+ TxControl = txControl
4141 } ;
4242 request . Parameters . Add ( parameters ) ;
4343
Original file line number Diff line number Diff line change @@ -41,19 +41,11 @@ internal ISession Session
4141
4242 internal bool EnableImplicitSession => ConnectionStringBuilder . EnableImplicitSession ;
4343
44- internal ISession GetExecutionSession ( bool useImplicit )
45- {
46- if ( ! useImplicit )
47- return Session ;
48-
49- if ( _implicitSource == null )
50- _implicitSource = new ImplicitSessionSource ( Session . Driver ) ;
51-
52- return new ImplicitSession ( Session . Driver , _implicitSource ) ;
53- }
54-
5544 private ImplicitSessionSource ? _implicitSource ;
5645
46+ internal ISession GetExecutionSession ( bool useImplicit ) =>
47+ useImplicit ? new ImplicitSession ( Session . Driver ) : Session ;
48+
5749 internal void AdoptSession ( ISession session ) => _session = session ;
5850
5951 public YdbConnection ( )
You can’t perform that action at this time.
0 commit comments