IDBContext
Provides a mockable interface with many common helper methods to interact with a database in a Relativity instance.
Typically, you should be using the Services API to interact with Relativity, however the DBContext provides direct access to the databases when needed.
Gets a database name.
Checks if database is Master context
Gets a database server name.
void BeginTransaction()
Starts a database transaction.
void Cancel()
Tries to cancel a SQL command execution.
void CommitTransaction()
Commits a database transaction.
Returns a database Parameter
Executes a Transact-SQL statement against the connection and returns the number of rows affected.
Executes a Transact-SQL statement against the connection and returns the number of rows affected.
Executes a parameterized Transact-SQL statement against the connection and returns the number of rows affected.
int ExecuteNonQuerySQLStatement(string sqlStatement, IEnumerable<SqlParameter> parameters, int timeoutValue)
Executes a Transact-SQL statement against the connection and returns the number of rows affected.
SqlDataReader ExecuteParameterizedSQLStatementAsReader(string sqlStatement, IEnumerable<SqlParameter> parameters, int timeoutValue = -1, bool sequentialAccess = false)
Executes a parameterized Transact-SQL statement against the connection and returns a sqlDataReader.
Executes a stored procedure against the connection and builds a DbDataReader.
Executes a stored procedure against the connection and returns the number of rows affected.
Executes a Transact-SQL statement against the connection and returns an in-memory cache of data.
Executes a parameterized Transact-SQL statement against the connection and returns an in-memory cache of data.
Executes a Transact-SQL statement against the connection and returns an in-memory cache of data.
DataSet ExecuteSqlStatementAsDataSet(string sqlStatement, IEnumerable<SqlParameter> parameters, int timeoutValue)
Executes a parameterized Transact-SQL statement against the connection and returns an in-memory cache of data.
Executes a Transact-SQL statement agains the connection and returns a table of in-memory data.
Executes a Transact-SQL statement agains the connection and returns a table of in-memory data.
Executes a parameterized Transact-SQL statement against the connection and returns a table of in-memory data.
DataTable ExecuteSqlStatementAsDataTable(string sqlStatement, int timeoutValue, IEnumerable<SqlParameter> parameters)
Executes a Transact-SQL statement agains the connection and returns a table of in-memory data.
Executes a Transact-SQL statement against the connection and builds a DbDataReader.
Executes a Transact-SQL statement against the connection and builds a DbDataReader.
DbDataReader ExecuteSqlStatementAsDbDataReader(string sqlStatement, IEnumerable<DbParameter> parameters)
Executes a Transact-SQL statement against the connection and builds a DbDataReader.
DbDataReader ExecuteSqlStatementAsDbDataReader(string sqlStatement, IEnumerable<DbParameter> parameters, int timeoutValue)
Executes a Transact-SQL statement against the connection and builds a DbDataReader.
IEnumerable<T> ExecuteSqlStatementAsEnumerable<T>(string sqlStatement, Func<SqlDataReader, T> converter, IEnumerable<SqlParameter> parameters)
Executes a Transact-SQL statement against the connection and returns the result as an IEnumerable<T> using the converter delegate.
IEnumerable<T> ExecuteSQLStatementAsEnumerable<T>(string sqlStatement, Func<SqlDataReader, T> converter, int timeout = -1)
Executes a Transact-SQL statement against the connection and returns the result as an IEnumerable<T> using the converter delegate.
Executes a SQL statement that expects a single result of type T, using the provided converter.
T ExecuteSqlStatementAsObject<T>(string sqlStatement, Func<SqlDataReader, T> convertor, int timeout = -1)
Executes a SQL statement that expects a single result of type T, using the provided converter and timeout.
T ExecuteSqlStatementAsObject<T>(string sqlStatement, Func<SqlDataReader, T> converter, IEnumerable<SqlParameter> parameters)
Executes a SQL statement that expects a single result of type T, using the provided converter, set of parameters.
T ExecuteSqlStatementAsObject<T>(string sqlStatement, Func<SqlDataReader, T> converter, IEnumerable<SqlParameter> parameters, int timeoutValue)
Executes a SQL statement that expects a single result of type T, using the provided converter, set of parameters, and timeout.
Executes a Transact-SQL statement against the connection and builds a SqlDataReader.
Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.
Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.
Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.
T ExecuteSqlStatementAsScalar<T>(string sqlStatement, IEnumerable<SqlParameter> parameters, int timeoutValue)
Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.
Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.
Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.
object ExecuteSqlStatementAsScalar(string sqlStatement, IEnumerable<SqlParameter> parameters, int timeoutValue)
Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.
object ExecuteSqlStatementAsScalarWithInnerTransaction(string sqlStatement, IEnumerable<SqlParameter> parameters, int timeoutValue)
Executes the query, and returns the first column of the first row in the result set returned by the query. Additional columns or rows are ignored.
ExecuteSqlStatementAsScalarWithInnerTransaction method can be called if context.transaction is not set
This method opens transaction internally. This functionality is implemented to enable query rerun in case on the problems
with Sql optimizer hints
Executes a Transact-SQL statement against the connection and returns a table of in-memory data.
Gets a database connection.
Gets a database connection, with option to open if closed.
Gets a database transaction.
void ReleaseConnection()
Releases a database connection.
void RollbackTransaction()
Rolls back a database transaction.
Rolls back a database transaction. Pass in inner exception if rollback times out.