Search Results for

    Show / Hide Table of Contents

    Class AdbConnectionBuilderBase

    An Adb connection builder base class for creating one AdbConnection, as well as AdbCommandBuilder instances. Each connection builder has an Adb provider and a connection string, that cannot be changed after they are created.

    A connection builder can only create a single connection. Use multiple instances, or a AdbConnectionString to handle multiple connections. See AdbConnectionBuilder and AdbKeepOpenConnectionBuilder for further details.

    Inheritance
    Object
    AdbConnectionBuilderBase
    AdbConnectionBuilder
    AdbKeepOpenConnectionBuilder
    Implements
    IAdbConnectionBuilder
    Namespace: actionETL.Adb
    Assembly: actionETL.dll
    Syntax
    public abstract class AdbConnectionBuilderBase : IAdbConnectionBuilder
    Remarks

    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.

    Properties

    ConnectionMode

    Specifies how connections are created, opened, and closed.

    Declaration
    public AdbConnectionMode ConnectionMode { get; }
    Property Value
    Type Description
    AdbConnectionMode

    ConnectionString

    Gets the connection string.

    Note: The connection string is set when the connection builder is created.

    Declaration
    public string ConnectionString { get; }
    Property Value
    Type Description
    String

    Provider

    Gets the Adb provider.

    Declaration
    public 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 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 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
    public abstract IAdbConnection Create()
    Returns
    Type Description
    IAdbConnection

    The Adb connection.

    Exceptions
    Type Condition
    ArgumentException

    Bad ConnectionString format.

    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
    public AdbCommandBuilder CreateCommandBuilder()
    Returns
    Type Description
    AdbCommandBuilder

    Returns an AdbCommandBuilder on success; throws an exception on error.

    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
    public AdbCommandBuilder CreateCommandBuilder(string queryText)
    Parameters
    Type Name Description
    String queryText

    The query text.

    Returns
    Type Description
    AdbCommandBuilder

    Returns an AdbCommandBuilder on success; throws an exception on error.

    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
    public 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 AdbCommandBuilder on success; throws an exception on error.

    ToString()

    Returns a string with the provider description, and the connection string.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String
    Overrides
    Object.ToString()

    Implements

    IAdbConnectionBuilder

    See Also

    AdbProvider
    AdbConnectionString
    IAdbConnectionBuilder
    AdbConnection
    AdbKeepOpenConnection
    AdbCommand
    In This Article
    Back to top Copyright © 2023 Envobi Ltd