Search Results for

    Show / Hide Table of Contents

    Class DatabaseConnection

    Database Connection

    Inheritance
    Object
    DatabaseConnection
    Implements
    IDatabaseConnection
    IDisposable
    Namespace: Gossip.Connection
    Assembly: Gossip.dll
    Syntax
    public class DatabaseConnection : object, IDatabaseConnection, IDisposable

    Constructors

    | Improve this Doc View Source

    DatabaseConnection(ISqlConnection, Int32, IQueryExecutorProvider, CancellationToken)

    Database Connection constructor

    Declaration
    public DatabaseConnection(ISqlConnection conn, int commandTimeout, IQueryExecutorProvider queryExecutorProvider, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    ISqlConnection conn

    Database connection

    Int32 commandTimeout

    Database Command Timeout

    IQueryExecutorProvider queryExecutorProvider

    Query executor

    CancellationToken cancellationToken

    Cancellation token

    Methods

    | Improve this Doc View Source

    BeginTransaction()

    Declaration
    public ITransaction BeginTransaction()
    Returns
    Type Description
    ITransaction
    | Improve this Doc View Source

    BeginTransaction(System.Data.IsolationLevel)

    Declaration
    public ITransaction BeginTransaction(System.Data.IsolationLevel isolationLevel)
    Parameters
    Type Name Description
    System.Data.IsolationLevel isolationLevel
    Returns
    Type Description
    ITransaction
    | Improve this Doc View Source

    BeginTransaction(System.Data.IsolationLevel, String)

    Declaration
    public ITransaction BeginTransaction(System.Data.IsolationLevel isolationLevel, string transactionName)
    Parameters
    Type Name Description
    System.Data.IsolationLevel isolationLevel
    String transactionName
    Returns
    Type Description
    ITransaction
    | Improve this Doc View Source

    BeginTransaction(String)

    Declaration
    public ITransaction BeginTransaction(string transactionName)
    Parameters
    Type Name Description
    String transactionName
    Returns
    Type Description
    ITransaction
    | Improve this Doc View Source

    Configure(String, String)

    Configures the database

    Declaration
    public IQueryConfigurator Configure(string callerMemberName = "", string callerFilePath = "")
    Parameters
    Type Name Description
    String callerMemberName

    (internal use) for logging

    String callerFilePath

    (internal use) for logging

    Returns
    Type Description
    IQueryConfigurator

    IQueryConfigurator

    | Improve this Doc View Source

    Dispose()

    Declaration
    public void Dispose()
    | Improve this Doc View Source

    EnlistTransaction(Transaction)

    Enlist a transaction

    Declaration
    public void EnlistTransaction(Transaction transaction)
    Parameters
    Type Name Description
    Transaction transaction

    transaction

    | Improve this Doc View Source

    Execute(String, Object, String, String)

    Execute parameterized SQL.

    Declaration
    public int Execute(string sql, object param = null, string callerMemberName = "", string callerFilePath = "")
    Parameters
    Type Name Description
    String sql

    The SQL to execute for this query.

    Object param

    The parameters to use for this query.

    String callerMemberName

    (internal use) for logging

    String callerFilePath

    (internal use) for logging

    Returns
    Type Description
    Int32

    The number of rows affected.

    | Improve this Doc View Source

    ExecuteAsync(String, Object, String, String)

    Execute parameterized SQL.

    Declaration
    public Task<int> ExecuteAsync(string sql, object param = null, string callerMemberName = "", string callerFilePath = "")
    Parameters
    Type Name Description
    String sql

    SQL query to run

    Object param

    Parameters to pass into the SQL query

    String callerMemberName

    Caller name

    String callerFilePath

    Caller location

    Returns
    Type Description
    Task<Int32>

    Integer number of rows affected

    | Improve this Doc View Source

    Query<T>(String, Object, String, String)

    Execute parameterized sql

    Declaration
    public IEnumerable<T> Query<T>(string sql, object param = null, string callerMemberName = "", string callerFilePath = "")
    Parameters
    Type Name Description
    String sql

    The SQL to execute for this query.

    Object param

    The parameters to use for this query.

    String callerMemberName

    (internal use) for logging

    String callerFilePath

    (internal use) for logging

    Returns
    Type Description
    IEnumerable<T>

    Result of the sql query, a collection of type T

    Type Parameters
    Name Description
    T

    generic type

    | Improve this Doc View Source

    QueryAsync<T>(String, Object, String, String)

    Execute parameterized SQL.

    Declaration
    public Task<IEnumerable<T>> QueryAsync<T>(string sql, object param = null, string callerMemberName = "", string callerFilePath = "")
    Parameters
    Type Name Description
    String sql

    SQL query to run

    Object param

    Parameters to pass into the SQL query

    String callerMemberName

    (internal use) for logging

    String callerFilePath

    (internal use) for logging

    Returns
    Type Description
    Task<IEnumerable<T>>

    SQL query result

    Type Parameters
    Name Description
    T

    Generic return type

    | Improve this Doc View Source

    QueryFirstOrDefaultAsync<T>(String, Object, String, String)

    Executes Parameterized SQL

    Declaration
    public Task<T> QueryFirstOrDefaultAsync<T>(string sql, object param = null, string callerMemberName = "", string callerFilePath = "")
    Parameters
    Type Name Description
    String sql

    The SQL to execute for this query.

    Object param

    The parameters to use for this query.

    String callerMemberName

    (internal use) for logging

    String callerFilePath

    (internal use) for logging

    Returns
    Type Description
    Task<T>

    The first result of the sql query

    Type Parameters
    Name Description
    T

    Generic Type

    | Improve this Doc View Source

    QuerySingleOrDefault<T>(String, String, String)

    Executes SQL

    Declaration
    public T QuerySingleOrDefault<T>(string sql, string callerMemberName = "", string callerFilePath = "")
    Parameters
    Type Name Description
    String sql

    The SQL to execute for this query.

    String callerMemberName

    (internal use) for logging

    String callerFilePath

    (internal use) for logging

    Returns
    Type Description
    T

    The first result of the sql query

    Type Parameters
    Name Description
    T

    Generic Type

    | Improve this Doc View Source

    QuerySingleOrDefaultAsync<T>(String, String, String)

    Execute sql

    Declaration
    public Task<T> QuerySingleOrDefaultAsync<T>(string sql, string callerMemberName = "", string callerFilePath = "")
    Parameters
    Type Name Description
    String sql

    The SQL to execute for this query.

    String callerMemberName

    (internal use) for logging

    String callerFilePath

    (internal use) for logging

    Returns
    Type Description
    Task<T>

    Result of the sql query, a collection of type T

    Type Parameters
    Name Description
    T

    generic type

    Implements

    IDatabaseConnection
    IDisposable
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX