File tree Expand file tree Collapse file tree
src/AdoNetCore.AseClient/Internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,13 +64,28 @@ public IInternalConnection Reserve(IInfoMessageEventNotifier eventNotifier)
6464 throw new OperationCanceledException ( ) ;
6565 }
6666
67- connection . ChangeDatabase ( _parameters . Database ) ;
68- connection . SetTextSize ( _parameters . TextSize ) ;
69- connection . NamedParameters = _parameters . NamedParameters ;
70-
71- if ( _parameters . AnsiNull )
67+ try
68+ {
69+ connection . ChangeDatabase ( _parameters . Database ) ;
70+ connection . SetTextSize ( _parameters . TextSize ) ;
71+ connection . NamedParameters = _parameters . NamedParameters ;
72+
73+ if ( _parameters . AnsiNull )
74+ {
75+ connection . SetAnsiNull ( _parameters . AnsiNull ) ;
76+ }
77+ }
78+ catch ( Exception )
7279 {
73- connection . SetAnsiNull ( _parameters . AnsiNull ) ;
80+ if ( _parameters . Pooling )
81+ {
82+ RemoveConnection ( connection ) ;
83+ }
84+ else
85+ {
86+ connection ? . Dispose ( ) ;
87+ }
88+ throw ;
7489 }
7590
7691 return connection ;
You can’t perform that action at this time.
0 commit comments