Otter SDK Reference
Version:

DatabaseContext Class

Represents a lightweight connection to a database that provides transaction support.

Inheritance Hierarchy

Syntax

public class DatabaseContext : System.IDisposable

Constructors

Name Description
DatabaseContext

Initializes a new instance of the DatabaseContext class.

DatabaseContext(bool keepConnection)

Initializes a new instance of the DatabaseContext class.

Properties

Name Description
Timeout

Gets or sets the timeout period in seconds.

UserName

Gets or sets the name of the user.

Methods

Name Description
BeginTransaction

Begins the transaction.

CommitTransaction

Commits the transaction.

CreateCommand(string storedProcName, GenericDbParameter[] parameters)

Creates the command.

CreateConnection

Creates an open connection.

CreateConnectionAsync

Creates an open connection.

Dispose

Releases resources used by the connection.

Dispose(bool disposing)

Releases resources used by the connection.

EnumerateTable<TRow>(string storedProcName, GenericDbParameter[] parameters)

Returns a streaming table result.

Execute(string storedProcName, GenericDbParameter[] parameters)

Executes the specified stored proc name.

ExecuteAsync(string storedProcName, GenericDbParameter[] parameters)

Executes the specified stored proc name.

ExecuteNonQuery(string storedProcName, GenericDbParameter[] parameters)

Executes the non query.

ExecuteNonQueryAsync(string storedProcName, GenericDbParameter[] parameters)

Executes the non query.

ExecuteScalarAsync<TResult>(string storedProcName, GenericDbParameter[] parameters, int outParameterIndex)

Executes the specified stored proc name.

ExecuteTableAsync<TRow>(string storedProcName, GenericDbParameter[] parameters)

Returns a streaming table result.

GetConnectionString

Returns the connection string for the database.

RollbackTransaction

Rollbacks the transaction.