Interface IAdbConnectionBuilder
An Adb connection builder interface that creates one AdbConnection (or its derived class AdbKeepOpenConnection) instance, as well as AdbCommandBuilder instances referencing the connection builder and the Adb connection it creates.
The Adb connection builder instance is created via factory methods on AdbProvider and AdbConnectionString.
Do design database workers to take AdbConnectionString,
IAdbConnectionBuilder, and AdbCommandBuilder instances as parameters, which allows
them to support connections with different AdbConnectionMode. Conversely,
avoid passing AdbConnection, AdbKeepOpenConnection, AdbCommand,
or connection (text) strings to workers.
Namespace: actionETL.Adb
Assembly: actionETL.dll
Syntax
public interface IAdbConnectionBuilder
Properties
ConnectionString
Gets the connection string.
Note: The connection string is set when the connection builder is created.
Declaration
string ConnectionString { get; }
Property Value
| Type | Description |
|---|---|
| String |
Provider
Gets the Adb provider.
Declaration
AdbProvider Provider { get; }
Property Value
| Type | Description |
|---|---|
| AdbProvider |
Methods
Create()
Creates an Adb database connection, using the connection details of the connection builder.
Note: The IAdbConnection 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
DisposeOnFinished<TDisposable>(TDisposable)
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.
Declaration
IAdbConnection Create()
Returns
| Type | Description |
|---|---|
| IAdbConnection | The Adb connection. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Bad ConnectionString format. |
| Exception | See the provider documentation for which specific exceptions Open() can throw, it typically includes DbException and InvalidOperationException. |
| InvalidOperationException | AdbConnectionBuilder: Each instance can only create a single AdbConnection instance. |
| ObjectDisposedException | AdbKeepOpenConnection: Cannot call Create() after disposing the object. |
CreateCommandBuilder()
Creates a database command builder instance with CommandType set to Text,
initialized with the connection details of the connection builder.
When an AdbCommand is created from this builder, it will not 'own' the
connection. The command must be disposed after use, but that will not automatically
dispose the connection (which must be disposed explicitly).
See Disposing Disposables for details.
Declaration
AdbCommandBuilder CreateCommandBuilder()
Returns
| Type | Description |
|---|---|
| AdbCommandBuilder | Returns an |
CreateCommandBuilder(String)
Creates a database command builder instance with CommandType set to Text,
initialized with the connection details of the connection builder.
When an AdbCommand is created from this builder, it will not 'own' the
connection. The command must be disposed after use, but that will not automatically
dispose the connection (which must be disposed explicitly).
See Disposing Disposables for details.
Declaration
AdbCommandBuilder CreateCommandBuilder(string queryText)
Parameters
| Type | Name | Description |
|---|---|---|
| String | queryText | The query text. |
Returns
| Type | Description |
|---|---|
| AdbCommandBuilder | Returns an |
CreateCommandBuilder(String, CommandType)
Creates a database command builder instance, initialized with the connection details of the connection builder. When an AdbCommand is created from this builder, it will not 'own' the connection. The command must be disposed after use, but that will not automatically dispose the connection (which must be disposed explicitly). See Disposing Disposables for details.
Declaration
AdbCommandBuilder CreateCommandBuilder(string queryText, CommandType commandType)
Parameters
| Type | Name | Description |
|---|---|---|
| String | queryText | The query text. |
| CommandType | commandType | Type of the command. |
Returns
| Type | Description |
|---|---|
| AdbCommandBuilder | Returns an |