Search Results for

    Show / Hide Table of Contents

    Interface ISqlConnection

    Represents a SQL connection.

    Namespace: Gossip.Connection.Fluent
    Assembly: Gossip.dll
    Syntax
    public interface ISqlConnection : IDisposable

    Methods

    | Improve this Doc View Source

    BeginTransaction()

    Begin a transaction.

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

    BeginTransaction(System.Data.IsolationLevel)

    Begin a transaction with a specified .

    Declaration
    ITransaction BeginTransaction(System.Data.IsolationLevel isolationLevel)
    Parameters
    Type Name Description
    System.Data.IsolationLevel isolationLevel

    The of the transaction.

    Returns
    Type Description
    ITransaction
    | Improve this Doc View Source

    BeginTransaction(System.Data.IsolationLevel, String)

    Begin a named transaction with a specified .

    Declaration
    ITransaction BeginTransaction(System.Data.IsolationLevel isolationLevel, string transactionName)
    Parameters
    Type Name Description
    System.Data.IsolationLevel isolationLevel

    The of the transaction.

    String transactionName

    The transaction name.

    Returns
    Type Description
    ITransaction
    | Improve this Doc View Source

    BeginTransaction(String)

    Begin a named transaction.

    Declaration
    ITransaction BeginTransaction(string transactionName)
    Parameters
    Type Name Description
    String transactionName

    The transaction name.

    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
    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
    void Close()
    | Improve this Doc View Source

    EnlistTransaction(Transaction)

    Enlist the given transaction.

    Declaration
    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
    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
    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)

    Synchronously execute the query and return a single value.

    Declaration
    T ExecuteScalar<T>(string query, object parameters, int commandTimeout, 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.

    IDbTransaction transaction

    The transaction to use for this query.

    Returns
    Type Description
    T

    A single result.

    Type Parameters
    Name Description
    T

    The type of data to return.

    | Improve this Doc View Source

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

    Synchronously execute the query and return a single value.

    Declaration
    Task<T> ExecuteScalarAsync<T>(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<T>

    A single result.

    Type Parameters
    Name Description
    T

    The type of data to return.

    | Improve this Doc View Source

    GetConnectionDetails()

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

    Declaration
    IConnectionDetails GetConnectionDetails()
    Returns
    Type Description
    IConnectionDetails

    The IConnectionDetails.

    | Improve this Doc View Source

    Open()

    Synchronously open the SQL connection.

    Declaration
    void Open()
    | Improve this Doc View Source

    OpenAsync(CancellationToken)

    Asynchronously open the SQL connection.

    Declaration
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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
    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.

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