Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of IDbConnection interface #1797

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 10 additions & 10 deletions Dapper.Rainbow/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public bool Delete(TId id)
}

/// <summary>
/// Gets a record with a particular Id from the DB
/// Gets a record with a particular Id from the DB
/// </summary>
/// <param name="id">The primary key of the table to fetch.</param>
/// <returns>The record with the specified Id.</returns>
Expand Down Expand Up @@ -173,22 +173,22 @@ public Table(Database<TDatabase> database, string likelyTableName)
}
}

private DbConnection _connection;
private IDbConnection _connection;
private int _commandTimeout;
private DbTransaction _transaction;
private IDbTransaction _transaction;

/// <summary>
/// Get underlying database connection.
/// </summary>
public DbConnection Connection => _connection;
public IDbConnection Connection => _connection;

/// <summary>
/// Initializes the database.
/// </summary>
/// <param name="connection">The connection to use.</param>
/// <param name="commandTimeout">The timeout to use (in seconds).</param>
/// <returns></returns>
public static TDatabase Init(DbConnection connection, int commandTimeout)
public static TDatabase Init(IDbConnection connection, int commandTimeout)
{
TDatabase db = new TDatabase();
db.InitDatabase(connection, commandTimeout);
Expand All @@ -197,7 +197,7 @@ public static TDatabase Init(DbConnection connection, int commandTimeout)

internal static Action<TDatabase> tableConstructor;

internal void InitDatabase(DbConnection connection, int commandTimeout)
internal void InitDatabase(IDbConnection connection, int commandTimeout)
{
_connection = connection;
_commandTimeout = commandTimeout;
Expand Down Expand Up @@ -370,7 +370,7 @@ private bool TableExists(string name)
_connection.QueryFirstOrDefault<T>(sql, param as object, _transaction, _commandTimeout);

/// <summary>
/// Perform a multi-mapping query with 2 input types.
/// Perform a multi-mapping query with 2 input types.
/// This returns a single type, combined from the raw types via <paramref name="map"/>.
/// </summary>
/// <typeparam name="TFirst">The first type in the recordset.</typeparam>
Expand All @@ -388,7 +388,7 @@ private bool TableExists(string name)
_connection.Query(sql, map, param as object, transaction, buffered, splitOn, commandTimeout);

/// <summary>
/// Perform a multi-mapping query with 3 input types.
/// Perform a multi-mapping query with 3 input types.
/// This returns a single type, combined from the raw types via <paramref name="map"/>.
/// </summary>
/// <typeparam name="TFirst">The first type in the recordset.</typeparam>
Expand All @@ -407,7 +407,7 @@ private bool TableExists(string name)
_connection.Query(sql, map, param as object, transaction, buffered, splitOn, commandTimeout);

/// <summary>
/// Perform a multi-mapping query with 4 input types.
/// Perform a multi-mapping query with 4 input types.
/// This returns a single type, combined from the raw types via <paramref name="map"/>.
/// </summary>
/// <typeparam name="TFirst">The first type in the recordset.</typeparam>
Expand All @@ -427,7 +427,7 @@ private bool TableExists(string name)
_connection.Query(sql, map, param as object, transaction, buffered, splitOn, commandTimeout);

/// <summary>
/// Perform a multi-mapping query with 5 input types.
/// Perform a multi-mapping query with 5 input types.
/// This returns a single type, combined from the raw types via <paramref name="map"/>.
/// </summary>
/// <typeparam name="TFirst">The first type in the recordset.</typeparam>
Expand Down