Interface IDatabaseConnection
Database Connection
Namespace: Gossip.Connection
Assembly: Gossip.dll
Syntax
public interface IDatabaseConnection : IDisposable
Methods
| Improve this Doc View SourceBeginTransaction()
Begin a transaction.
Declaration
ITransaction BeginTransaction()
Returns
| Type | Description |
|---|---|
| ITransaction |
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 |
Returns
| Type | Description |
|---|---|
| ITransaction |
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 |
| String | transactionName | The transaction name. |
Returns
| Type | Description |
|---|---|
| ITransaction |
BeginTransaction(String)
Begin a named transaction.
Declaration
ITransaction BeginTransaction(string transactionName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | transactionName | The transaction name. |
Returns
| Type | Description |
|---|---|
| ITransaction |
Configure(String, String)
Configures the database
Declaration
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 |
EnlistTransaction(Transaction)
Enlist a transaction
Declaration
void EnlistTransaction(Transaction transaction)
Parameters
| Type | Name | Description |
|---|---|---|
| Transaction | transaction | transaction |
Execute(String, Object, String, String)
Execute parameterized SQL.
Declaration
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. |
ExecuteAsync(String, Object, String, String)
Execute parameterized SQL.
Declaration
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 |
Query<T>(String, Object, String, String)
Execute parameterized sql
Declaration
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 |
QueryAsync<T>(String, Object, String, String)
Execute parameterized SQL.
Declaration
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 |
QueryFirstOrDefaultAsync<T>(String, Object, String, String)
Executes Parameterized SQL
Declaration
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 |
QuerySingleOrDefault<T>(String, String, String)
Executes SQL
Declaration
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 |
QuerySingleOrDefaultAsync<T>(String, String, String)
Execute sql
Declaration
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 |