Search Results for

    Show / Hide Table of Contents

    Class SqlConnectionWrapper

    SQL connection wrapper

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

    Constructors

    | Improve this Doc View Source

    SqlConnectionWrapper(IConnectionString)

    SQL connection wrapper constructor

    Declaration
    public SqlConnectionWrapper(IConnectionString connectionString)
    Parameters
    Type Name Description
    IConnectionString connectionString

    Database connection string

    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

    BulkInsertAsync<T>(String, IEnumerable<T>, Int32, Action<Object, SqlRowsCopiedEventArgs>, Int32, Dictionary<String, String>, Int32)

    Bulk insert data into a table.

    Declaration
    public Task BulkInsertAsync<T>(string insertIntoTable, IEnumerable<T> data, int batchSize = 1000, Action<object, SqlRowsCopiedEventArgs> notifyCallback = null, int notifyAfter = 10000, Dictionary<string, string> columnMapping = null, int timeoutSeconds = 30)
    Parameters
    Type Name Description
    String insertIntoTable

    The name of the table.

    IEnumerable<T> data

    The data to insert.

    Int32 batchSize

    The size of the batches for bulk insert.

    Action<Object, SqlRowsCopiedEventArgs> notifyCallback

    A callback to pass to .

    Int32 notifyAfter

    Occurs after each batch has been processed.

    Dictionary<String, String> columnMapping

    A dictionary of column mappings.

    Int32 timeoutSeconds

    The timeout, specified in seconds.

    Returns
    Type Description
    Task
    Type Parameters
    Name Description
    T

    The type of data being bulk inserted.

    | Improve this Doc View Source

    Close()

    Synchronously close the SQL connection.

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

    CreateCommandDefinition(String, Object, Nullable<Int32>, CancellationToken, IDbTransaction)

    Creates Command Definition

    Declaration
    public CommandDefinition CreateCommandDefinition(string query, object parameters, int? commandTimeout, CancellationToken cancellationToken, IDbTransaction transaction)
    Parameters
    Type Name Description
    String query

    SQL command

    Object parameters

    Parameters to pass into SQL command

    Nullable<Int32> commandTimeout

    SQL command timeout

    CancellationToken cancellationToken

    cancellation token

    IDbTransaction transaction

    The transaction

    Returns
    Type Description
    CommandDefinition

    Command Definition

    | Improve this Doc View Source

    Dispose()

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

    EnlistTransaction(Transaction)

    Enlist the given transaction.

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

    The transaction to enlist.

    | Improve this Doc View Source

    Execute(String, Object, Int32, CancellationToken, IDbTransaction)

    Synchronously execute the query.

    Declaration
    public int Execute(string query, object parameters, int commandTimeout, CancellationToken cancellationToken, IDbTransaction transaction)
    Parameters
    Type Name Description
    String query

    The SQL to execute for this query.

    Object parameters

    The parameters to use for this query.

    Int32 commandTimeout

    Number of seconds before command execution timeout.

    CancellationToken cancellationToken

    A cancellation token for cooperatively cancelling the operation.

    IDbTransaction transaction

    The transaction to use for this query.

    Returns
    Type Description
    Int32

    The number of rows impacted by the query.

    | Improve this Doc View Source

    ExecuteAsync(String, Object, Int32, CancellationToken, IDbTransaction)

    Asynchronously execute the query.

    Declaration
    public Task<int> ExecuteAsync(string query, object parameters, int commandTimeout, CancellationToken cancellationToken, IDbTransaction transaction)
    Parameters
    Type Name Description
    String query

    The SQL to execute for this query.

    Object parameters

    The parameters to use for this query.

    Int32 commandTimeout

    Number of seconds before command execution timeout.

    CancellationToken cancellationToken

    A cancellation token for cooperatively cancelling the operation.

    IDbTransaction transaction

    The transaction to use for this query.

    Returns
    Type Description
    Task<Int32>

    The number of rows impacted by the query.

    | Improve this Doc View Source

    ExecuteScalar<T>(String, Object, Int32, IDbTransaction)

    Declaration
    public T ExecuteScalar<T>(string query, object parameters, int commandTimeout, IDbTransaction transaction)
    Parameters
    Type Name Description
    String query
    Object parameters
    Int32 commandTimeout
    IDbTransaction transaction
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    ExecuteScalarAsync<T>(String, Object, Int32, CancellationToken, IDbTransaction)

    Declaration
    public Task<T> ExecuteScalarAsync<T>(string query, object parameters, int commandTimeout, CancellationToken cancellationToken, IDbTransaction transaction)
    Parameters
    Type Name Description
    String query
    Object parameters
    Int32 commandTimeout
    CancellationToken cancellationToken
    IDbTransaction transaction
    Returns
    Type Description
    Task<T>
    Type Parameters
    Name Description
    T
    | Improve this Doc View Source

    GetConnectionDetails()

    Get the connection details such as the server and database name.

    Declaration
    public IConnectionDetails GetConnectionDetails()
    Returns
    Type Description
    IConnectionDetails

    The IConnectionDetails.

    | Improve this Doc View Source

    GetSqlConnection()

    Gets sql connection

    Declaration
    public SqlConnection GetSqlConnection()
    Returns
    Type Description
    SqlConnection

    SqlConnection

    | Improve this Doc View Source

    Open()

    Synchronously open the SQL connection.

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

    OpenAsync(CancellationToken)

    Asynchronously open the SQL connection.

    Declaration
    public Task OpenAsync(CancellationToken cancellationToken)
    Parameters
    Type Name Description
    CancellationToken cancellationToken

    A cancellation token for cooperatively cancelling the operation.

    Returns
    Type Description
    Task
    | Improve this Doc View Source

    Query<T>(String, Object, Int32, Boolean, IDbTransaction)

    Synchronously execute the query and return the results.

    Declaration
    public IEnumerable<T> Query<T>(string query, object parameters, int commandTimeout, bool buffered, IDbTransaction transaction)
    Parameters
    Type Name Description
    String query

    The query to execute.

    Object parameters

    The parameters for the query.

    Int32 commandTimeout

    The effective timeout for the command.

    Boolean buffered

    Whether to buffer the results in memory or not.

    IDbTransaction transaction

    An for transactional functionality.

    Returns
    Type Description
    IEnumerable<T>

    The of results.

    Type Parameters
    Name Description
    T

    The type of results to return.

    | Improve this Doc View Source

    QueryAsync<T>(String, Object, Int32, CancellationToken, IDbTransaction)

    Asynchronously execute the query and return the results.

    Declaration
    public Task<IEnumerable<T>> QueryAsync<T>(string query, object parameters, int commandTimeout, CancellationToken cancellationToken, IDbTransaction transaction)
    Parameters
    Type Name Description
    String query

    The query to execute.

    Object parameters

    The parameters for the query.

    Int32 commandTimeout

    The effective timeout for the command.

    CancellationToken cancellationToken

    A cancellation token to cooperatively cancel the operation.

    IDbTransaction transaction

    An for transactional functionality.

    Returns
    Type Description
    Task<IEnumerable<T>>

    The of results.

    Type Parameters
    Name Description
    T

    The type of results to return.

    | Improve this Doc View Source

    QueryAsync<TFirst, TSecond, TReturn>(String, Func<TFirst, TSecond, TReturn>, Object, Int32, IDbTransaction)

    Perform a asynchronous multi-mapping query with 2 input types. This returns a single type, combined from the raw types via mapping.

    Declaration
    public Task<IEnumerable<TReturn>> QueryAsync<TFirst, TSecond, TReturn>(string query, Func<TFirst, TSecond, TReturn> mapping, object parameters, int commandTimeout, IDbTransaction transaction)
    Parameters
    Type Name Description
    String query

    The SQL to execute for this query.

    Func<TFirst, TSecond, TReturn> mapping

    The function to map row types to the return type.

    Object parameters

    The parameters to use for this query.

    Int32 commandTimeout

    Number of seconds before command execution timeout.

    IDbTransaction transaction

    The transaction to use for this query.

    Returns
    Type Description
    Task<IEnumerable<TReturn>>

    An enumerable of TReturn.

    Type Parameters
    Name Description
    TFirst

    The first type in the recordset.

    TSecond

    The second type in the recordset.

    TReturn

    The combined type to return.

    | Improve this Doc View Source

    QueryAsync<TFirst, TSecond, TThird, TReturn>(String, Func<TFirst, TSecond, TThird, TReturn>, Object, Int32, IDbTransaction)

    Perform a asynchronous multi-mapping query with 3 input types. This returns a single type, combined from the raw types via mapping.

    Declaration
    public Task<IEnumerable<TReturn>> QueryAsync<TFirst, TSecond, TThird, TReturn>(string query, Func<TFirst, TSecond, TThird, TReturn> mapping, object parameters, int commandTimeout, IDbTransaction transaction)
    Parameters
    Type Name Description
    String query

    The SQL to execute for this query.

    Func<TFirst, TSecond, TThird, TReturn> mapping

    The function to map row types to the return type.

    Object parameters

    The parameters to use for this query.

    Int32 commandTimeout

    Number of seconds before command execution timeout.

    IDbTransaction transaction

    The transaction to use for this query.

    Returns
    Type Description
    Task<IEnumerable<TReturn>>

    An enumerable of TReturn.

    Type Parameters
    Name Description
    TFirst

    The first type in the recordset.

    TSecond

    The second type in the recordset.

    TThird

    The third type in the recordset.

    TReturn

    The combined type to return.

    | Improve this Doc View Source

    QueryAsync<TFirst, TSecond, TThird, TFourth, TReturn>(String, Func<TFirst, TSecond, TThird, TFourth, TReturn>, Object, Int32, IDbTransaction)

    Perform a asynchronous multi-mapping query with 4 input types. This returns a single type, combined from the raw types via mapping.

    Declaration
    public Task<IEnumerable<TReturn>> QueryAsync<TFirst, TSecond, TThird, TFourth, TReturn>(string query, Func<TFirst, TSecond, TThird, TFourth, TReturn> mapping, object parameters, int commandTimeout, IDbTransaction transaction)
    Parameters
    Type Name Description
    String query

    The SQL to execute for this query.

    Func<TFirst, TSecond, TThird, TFourth, TReturn> mapping

    The function to map row types to the return type.

    Object parameters

    The parameters to use for this query.

    Int32 commandTimeout

    Number of seconds before command execution timeout.

    IDbTransaction transaction

    The transaction to use for this query.

    Returns
    Type Description
    Task<IEnumerable<TReturn>>

    An enumerable of TReturn.

    Type Parameters
    Name Description
    TFirst

    The first type in the recordset.

    TSecond

    The second type in the recordset.

    TThird

    The third type in the recordset.

    TFourth

    The fourth type in the recordset.

    TReturn

    The combined type to return.

    | Improve this Doc View Source

    QueryAsync<TFirst, TSecond, TThird, TFourth, TFifth, TReturn>(String, Func<TFirst, TSecond, TThird, TFourth, TFifth, TReturn>, Object, Int32, IDbTransaction)

    Perform a asynchronous multi-mapping query with 5 input types. This returns a single type, combined from the raw types via mapping.

    Declaration
    public Task<IEnumerable<TReturn>> QueryAsync<TFirst, TSecond, TThird, TFourth, TFifth, TReturn>(string query, Func<TFirst, TSecond, TThird, TFourth, TFifth, TReturn> mapping, object parameters, int commandTimeout, IDbTransaction transaction)
    Parameters
    Type Name Description
    String query

    The SQL to execute for this query.

    Func<TFirst, TSecond, TThird, TFourth, TFifth, TReturn> mapping

    The function to map row types to the return type.

    Object parameters

    The parameters to use for this query.

    Int32 commandTimeout

    Number of seconds before command execution timeout.

    IDbTransaction transaction

    The transaction to use for this query.

    Returns
    Type Description
    Task<IEnumerable<TReturn>>

    An enumerable of TReturn.

    Type Parameters
    Name Description
    TFirst

    The first type in the recordset.

    TSecond

    The second type in the recordset.

    TThird

    The third type in the recordset.

    TFourth

    The fourth type in the recordset.

    TFifth

    The fifth type in the recordset.

    TReturn

    The combined type to return.

    | Improve this Doc View Source

    QueryAsync<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TReturn>(String, Func<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TReturn>, Object, Int32, IDbTransaction)

    Perform a asynchronous multi-mapping query with 6 input types. This returns a single type, combined from the raw types via mapping.

    Declaration
    public Task<IEnumerable<TReturn>> QueryAsync<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TReturn>(string query, Func<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TReturn> mapping, object parameters, int commandTimeout, IDbTransaction transaction)
    Parameters
    Type Name Description
    String query

    The SQL to execute for this query.

    Func<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TReturn> mapping

    The function to map row types to the return type.

    Object parameters

    The parameters to use for this query.

    Int32 commandTimeout

    Number of seconds before command execution timeout.

    IDbTransaction transaction

    The transaction to use for this query.

    Returns
    Type Description
    Task<IEnumerable<TReturn>>

    An enumerable of TReturn.

    Type Parameters
    Name Description
    TFirst

    The first type in the recordset.

    TSecond

    The second type in the recordset.

    TThird

    The third type in the recordset.

    TFourth

    The fourth type in the recordset.

    TFifth

    The fifth type in the recordset.

    TSixth

    The sixth type in the recordset.

    TReturn

    The combined type to return.

    | Improve this Doc View Source

    QueryAsync<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh, TReturn>(String, Func<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh, TReturn>, Object, Int32, IDbTransaction)

    Perform a asynchronous multi-mapping query with 7 input types. This returns a single type, combined from the raw types via mapping.

    Declaration
    public Task<IEnumerable<TReturn>> QueryAsync<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh, TReturn>(string query, Func<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh, TReturn> mapping, object parameters, int commandTimeout, IDbTransaction transaction)
    Parameters
    Type Name Description
    String query

    The SQL to execute for this query.

    Func<TFirst, TSecond, TThird, TFourth, TFifth, TSixth, TSeventh, TReturn> mapping

    The function to map row types to the return type.

    Object parameters

    The parameters to use for this query.

    Int32 commandTimeout

    Number of seconds before command execution timeout.

    IDbTransaction transaction

    The transaction to use for this query.

    Returns
    Type Description
    Task<IEnumerable<TReturn>>
    Type Parameters
    Name Description
    TFirst

    The first type in the recordset.

    TSecond

    The second type in the recordset.

    TThird

    The third type in the recordset.

    TFourth

    The fourth type in the recordset.

    TFifth

    The fifth type in the recordset.

    TSixth

    The sixth type in the recordset.

    TSeventh

    The seventh type in the recordset.

    TReturn

    The combined type to return.

    | Improve this Doc View Source

    QueryFirstOrDefault<T>(String, Object, Int32, CancellationToken, IDbTransaction)

    Synchronously query for the first result, or the default value of if no result is found.

    Declaration
    public T QueryFirstOrDefault<T>(string query, object parameters, int commandTimeout, CancellationToken cancellationToken, IDbTransaction transaction)
    Parameters
    Type Name Description
    String query

    The query to execute.

    Object parameters

    The parameters for the query.

    Int32 commandTimeout

    The effective timeout for the command.

    CancellationToken cancellationToken

    A cancellation token to cooperatively cancel the operation.

    IDbTransaction transaction

    An for transactional functionality.

    Returns
    Type Description
    T

    The first result of the query, or the default value of if no result is found.

    Type Parameters
    Name Description
    T

    The type of results to return.

    | Improve this Doc View Source

    QueryFirstOrDefaultAsync<T>(String, Object, Int32, CancellationToken, IDbTransaction)

    Asynchronously query for the first result, or the default value of if no result is found.

    Declaration
    public Task<T> QueryFirstOrDefaultAsync<T>(string query, object parameters, int commandTimeout, CancellationToken cancellationToken, IDbTransaction transaction)
    Parameters
    Type Name Description
    String query

    The query to execute.

    Object parameters

    The parameters for the query.

    Int32 commandTimeout

    The effective timeout for the command.

    CancellationToken cancellationToken

    A cancellation token to cooperatively cancel the operation.

    IDbTransaction transaction

    An for transactional functionality.

    Returns
    Type Description
    Task<T>

    The first result of the query, or the default value of if no result is found.

    Type Parameters
    Name Description
    T

    The type of results to return.

    | Improve this Doc View Source

    QuerySingleOrDefault<T>(String, Object, Int32, CancellationToken, IDbTransaction)

    Synchronously query for a single result, or the default value of if no result is found.

    Declaration
    public T QuerySingleOrDefault<T>(string query, object parameters, int commandTimeout, CancellationToken cancellationToken, IDbTransaction transaction)
    Parameters
    Type Name Description
    String query

    The query to execute.

    Object parameters

    The parameters for the query.

    Int32 commandTimeout

    The effective timeout for the command.

    CancellationToken cancellationToken

    A cancellation token to cooperatively cancel the operation.

    IDbTransaction transaction

    An for transactional functionality.

    Returns
    Type Description
    T

    The result of the query, or the default value of if no result is found.

    Type Parameters
    Name Description
    T

    The type of results to return.

    | Improve this Doc View Source

    QuerySingleOrDefaultAsync<T>(String, Object, Int32, CancellationToken, IDbTransaction)

    Asynchronously query for a single result, or the default value of if no result is found.

    Declaration
    public Task<T> QuerySingleOrDefaultAsync<T>(string query, object parameters, int commandTimeout, CancellationToken cancellationToken, IDbTransaction transaction)
    Parameters
    Type Name Description
    String query

    The query to execute.

    Object parameters

    The parameters for the query.

    Int32 commandTimeout

    The effective timeout for the command.

    CancellationToken cancellationToken

    A cancellation token to cooperatively cancel the operation.

    IDbTransaction transaction

    An for transactional functionality.

    Returns
    Type Description
    Task<T>

    The result of the query, or the default value of if no result is found.

    Type Parameters
    Name Description
    T

    The type of results to return.

    Implements

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