Class SqlDatabaseCommitVersionsContext
Represents an object used for managing application of versions to the database.
public class SqlDatabaseCommitVersionsContext : IDisposable
- Inheritance
-
SqlDatabaseCommitVersionsContext
- Implements
- Inherited Members
Constructors
SqlDatabaseCommitVersionsContext()
Creates a new SqlDatabaseCommitVersionsContext instance.
protected SqlDatabaseCommitVersionsContext()
Methods
AddCommandParameter(DbCommand, SqlColumnBuilder)
Adds a DB parameter to the provided command
based on the column
definition.
protected static void AddCommandParameter(DbCommand command, SqlColumnBuilder column)
Parameters
command
DbCommandDB command to add a DB parameter to.
column
SqlColumnBuilderSQL column builder to use for initializing the DB parameter.
Dispose()
public virtual void Dispose()
GetVersionHistoryColumnType(string)
Returns an SqlColumnTypeDefinition of a version history table's column with the provided name
.
[Pure]
protected SqlColumnTypeDefinition GetVersionHistoryColumnType(string name)
Parameters
name
stringName of the column.
Returns
- SqlColumnTypeDefinition
SqlColumnTypeDefinition of a version history table's column with the provided
name
.
Exceptions
- KeyNotFoundException
When version history table column with the provided name does not exist.
OnAfterVersionActionRangeExecution(SqlDatabaseBuilder, SqlDatabaseFactoryStatementKey, DbCommand, ref SqlDatabaseFactoryStatementExecutor)
Callback invoked just after a range of SQL statements prepared for a single applied version has been executed.
protected virtual SqlDatabaseFactoryStatementKey OnAfterVersionActionRangeExecution(SqlDatabaseBuilder builder, SqlDatabaseFactoryStatementKey key, DbCommand command, ref SqlDatabaseFactoryStatementExecutor executor)
Parameters
builder
SqlDatabaseBuilderSQL database builder.
key
SqlDatabaseFactoryStatementKeySqlDatabaseFactoryStatementKey instance that identifies the last SQL statement of the applied version.
command
DbCommandDB command that executed all statements.
executor
SqlDatabaseFactoryStatementExecutorDecorator for executing SQL statements on the database.
Returns
- SqlDatabaseFactoryStatementKey
SqlDatabaseFactoryStatementKey instance that identifies the last ran SQL statement of the applied version.
OnAfterVersionRangeApplication(SqlDatabaseBuilder, DbConnection, ref SqlDatabaseFactoryStatementExecutor)
Callback invoked just after the processing of all versions to apply has finished.
protected virtual void OnAfterVersionRangeApplication(SqlDatabaseBuilder builder, DbConnection connection, ref SqlDatabaseFactoryStatementExecutor executor)
Parameters
builder
SqlDatabaseBuilderSQL database builder.
connection
DbConnectionOpened connection to the database.
executor
SqlDatabaseFactoryStatementExecutorDecorator for executing SQL statements on the database.
OnAfterVersionTransaction(SqlDatabaseBuilder, SqlDatabaseFactoryStatementKey, DbConnection, ref SqlDatabaseFactoryStatementExecutor)
Callback invoked just after a DB transaction for a single applied version is committed.
protected virtual void OnAfterVersionTransaction(SqlDatabaseBuilder builder, SqlDatabaseFactoryStatementKey key, DbConnection connection, ref SqlDatabaseFactoryStatementExecutor executor)
Parameters
builder
SqlDatabaseBuilderSQL database builder.
key
SqlDatabaseFactoryStatementKeySqlDatabaseFactoryStatementKey instance that identifies the last SQL statement of the applied version.
connection
DbConnectionOpened connection to the database.
executor
SqlDatabaseFactoryStatementExecutorDecorator for executing SQL statements on the database.
OnBeforeVersionActionRangeExecution(SqlDatabaseBuilder, SqlDatabaseFactoryStatementKey, DbCommand, ref SqlDatabaseFactoryStatementExecutor)
Callback invoked just before a range of SQL statements prepared for a single applied version is executed.
protected virtual SqlDatabaseFactoryStatementKey OnBeforeVersionActionRangeExecution(SqlDatabaseBuilder builder, SqlDatabaseFactoryStatementKey key, DbCommand command, ref SqlDatabaseFactoryStatementExecutor executor)
Parameters
builder
SqlDatabaseBuilderSQL database builder.
key
SqlDatabaseFactoryStatementKeySqlDatabaseFactoryStatementKey instance that identifies the last SQL statement of the applied version.
command
DbCommandDB command that will execute all statements.
executor
SqlDatabaseFactoryStatementExecutorDecorator for executing SQL statements on the database.
Returns
- SqlDatabaseFactoryStatementKey
SqlDatabaseFactoryStatementKey instance that identifies the last ran SQL statement of the applied version.
OnBeforeVersionRangeApplication(SqlDatabaseBuilder, DbConnection, ref SqlDatabaseFactoryStatementExecutor)
Callback invoked just before the processing of all versions to apply starts.
protected virtual void OnBeforeVersionRangeApplication(SqlDatabaseBuilder builder, DbConnection connection, ref SqlDatabaseFactoryStatementExecutor executor)
Parameters
builder
SqlDatabaseBuilderSQL database builder.
connection
DbConnectionOpened connection to the database.
executor
SqlDatabaseFactoryStatementExecutorDecorator for executing SQL statements on the database.
OnBeforeVersionTransaction(SqlDatabaseBuilder, SqlDatabaseFactoryStatementKey, DbConnection, ref SqlDatabaseFactoryStatementExecutor)
Callback invoked just before a DB transaction for a single applied version is created.
protected virtual SqlDatabaseFactoryStatementKey OnBeforeVersionTransaction(SqlDatabaseBuilder builder, SqlDatabaseFactoryStatementKey key, DbConnection connection, ref SqlDatabaseFactoryStatementExecutor executor)
Parameters
builder
SqlDatabaseBuilderSQL database builder.
key
SqlDatabaseFactoryStatementKeySqlDatabaseFactoryStatementKey instance that identifies the last SQL statement of the applied version.
connection
DbConnectionOpened connection to the database.
executor
SqlDatabaseFactoryStatementExecutorDecorator for executing SQL statements on the database.
Returns
- SqlDatabaseFactoryStatementKey
SqlDatabaseFactoryStatementKey instance that identifies the last ran SQL statement of the applied version.
PrepareDeleteAllVersionHistoryRecordsCommand(DbCommand, SqlTableBuilder, SqlNodeInterpreter)
Prepares a DB command responsible for removing all records from the version history table.
protected virtual void PrepareDeleteAllVersionHistoryRecordsCommand(DbCommand command, SqlTableBuilder table, SqlNodeInterpreter nodeInterpreter)
Parameters
command
DbCommandDB command to prepare.
table
SqlTableBuilderSQL table builder for the version history table.
nodeInterpreter
SqlNodeInterpreterSQL node interpreter instance.
PrepareInsertVersionHistoryRecordCommand(DbCommand, SqlTableBuilder, SqlNodeInterpreter)
Prepares a DB command responsible for inserting a single record into the version history table.
protected virtual void PrepareInsertVersionHistoryRecordCommand(DbCommand command, SqlTableBuilder table, SqlNodeInterpreter nodeInterpreter)
Parameters
command
DbCommandDB command to prepare.
table
SqlTableBuilderSQL table builder for the version history table.
nodeInterpreter
SqlNodeInterpreterSQL node interpreter instance.
PrepareUpdateVersionHistoryRecordCommand(DbCommand, SqlTableBuilder, SqlNodeInterpreter)
Prepares a DB command responsible for updating a single record in the version history table.
protected virtual void PrepareUpdateVersionHistoryRecordCommand(DbCommand command, SqlTableBuilder table, SqlNodeInterpreter nodeInterpreter)
Parameters
command
DbCommandDB command to prepare.
table
SqlTableBuilderSQL table builder for the version history table.
nodeInterpreter
SqlNodeInterpreterSQL node interpreter instance.
SetInsertVersionHistoryRecordCommandParameters(DbParameterCollection, int, Version, string)
Prepares values of DB parameters of a command responsible for inserting a single record into the version history table.
protected virtual void SetInsertVersionHistoryRecordCommandParameters(DbParameterCollection parameters, int ordinal, Version version, string description)
Parameters
parameters
DbParameterCollectionCollection of DB parameters.
ordinal
intOrdinal of the record to insert.
version
VersionIdentifier of the applied version.
description
stringDescription of the applied version.
SetUpdateVersionHistoryRecordCommandParameters(DbParameterCollection, int, TimeSpan)
Prepares values of DB parameters of a command responsible for updating a single record in the version history table.
protected virtual void SetUpdateVersionHistoryRecordCommandParameters(DbParameterCollection parameters, int ordinal, TimeSpan elapsedTime)
Parameters
parameters
DbParameterCollectionCollection of DB parameters.
ordinal
intOrdinal of the record to update.
elapsedTime
TimeSpanSpecifies the time it took to fully apply the version to the database.