Closed ejball closed 3 years ago
Maybe there's a better name?
The more I think about it, the ability to temporarily close an AutoOpen/LazyOpen
connection seems like the only interesting use case, in which case maybe RefreshConnection(Async)
would be defined as closing and (lazy) opening the connection.
ReleaseConnection
?
"Refresh" to me implies ensuring it's connected, which is the opposite of the intent (as I understand it).
Normally the connection is closed when the disposable returned by
OpenConnection
is disposed, or, in the case ofAutoOpen
, when the connector itself is disposed.CloseConnection(Async)
would allow the connection to be closed earlier than normal.In the case of
AutoOpen
, we should reopen the connection immediately, which makes this not very useful, unlessLazyOpen
is also in use, in which case it won't open until (and unless) it is used again. This is probably the best use case of the new method, but it might also make the code confusing when the connection is used again later after being explicitly closed and without being explicitly opened. Maybe there's a better name?There's already a private implementation of
CloseConnection(Async)
, which is fine, except we should allow an already-closed connection to be closed, and we need to respectAutoOpen
andLazyOpen
.