The key feature of "KeepOpen" connections is that they keep the underlying .NET
DbConnection open even after a worker calls
Dispose(). This allows using a single transaction or specific temporary table(s)
across multiple workers, which can be very useful. When this functionality
is not needed, a standard AdbConnectionBuilder should be used instead.
Note: This builder (unlike AdbConnectionBuilder) must be disposed after use - it is only then that the underlying .NET connection will be closed and disposed.
public sealed class AdbKeepOpenConnectionBuilder : AdbConnectionBuilderBase, IAdbConnectionBuilder, IDisposable
Do design database workers to take
AdbCommandBuilder instances as parameters, which allows
them to support connections with different AdbConnectionMode. Conversely,
or connection (text) strings to workers.
Adb Keep Open Connection has examples of how to use this class.
Creates an Adb "KeepOpen" database connection, using the connection details of the
AdbConnection instance is not thread-safe, and must only be used
in a single place (in a single worker) at any one time.
The connection can be opened and closed multiple times as needed, and it must
be disposed after use. Disposal should almost always be done by whoever created the
connection, typically via
or UsingActionWorker<TDisposable> if used across multiple method calls,
or by a
using statement if created and disposed in a single method and thread, without
being passed to any other workers.
See Disposing Disposables for details.
Note however that closing and disposing the "KeepOpen" connection does not actually close or dispose the underlying .NET connection. This only happens when this connection builder instance that created the connection is disposed.
public override IAdbConnection Create()
Bad ConnectionString format.
Disposes the keep open connection builder, which also closes and disposes its connection, and rolls back any active transaction.
public void Dispose()