C# Class StandardExtensions, DbUp

Configuration extensions for the standard stuff.
ファイルを表示 Open project: DbUp/DbUp Class Usage Examples

Public Methods

Method Description
JournalTo ( this builder, IJournal journal ) : DbUp.Builder.UpgradeEngineBuilder

Uses a custom journal for recording which scripts were executed.

LogScriptOutput ( this builder ) : DbUp.Builder.UpgradeEngineBuilder

Logs to the console using pretty colours.

LogTo ( this builder, IUpgradeLog log ) : DbUp.Builder.UpgradeEngineBuilder

Logs to a custom logger.

LogToConsole ( this builder ) : DbUp.Builder.UpgradeEngineBuilder

Logs to the console using pretty colours.

LogToSqlContext ( this builder ) : DbUp.Builder.UpgradeEngineBuilder

Logs to SqlContext.Pipe, for use with "context connection=true".

LogToTrace ( this builder ) : DbUp.Builder.UpgradeEngineBuilder

Logs to System.Diagnostics.Trace.

WithExecutionTimeout ( this builder, TimeSpan timeout ) : DbUp.Builder.UpgradeEngineBuilder

Allows you to set the execution timeout for scripts.

Setting the timeout parameter to null will use the default timeout of the underlying provider.

WithPreprocessor ( this builder, IScriptPreprocessor preprocessor ) : DbUp.Builder.UpgradeEngineBuilder

Adds a preprocessor that can replace portions of a script.

WithScript ( this builder, DbUp.Engine.SqlScript script ) : DbUp.Builder.UpgradeEngineBuilder

Adds a single static script to the upgrader.

WithScript ( this builder, string name, string contents ) : DbUp.Builder.UpgradeEngineBuilder

Adds a single static script to the upgrader.

WithScripts ( this builder ) : DbUp.Builder.UpgradeEngineBuilder

Adds a static set of scripts to the upgrader.

WithScripts ( this builder, IEnumerable scripts ) : DbUp.Builder.UpgradeEngineBuilder

Adds a static set of scripts to the upgrader.

WithScripts ( this builder, IScriptProvider scriptProvider ) : DbUp.Builder.UpgradeEngineBuilder

Adds a custom script provider to the upgrader.

WithScriptsAndCodeEmbeddedInAssembly ( this builder, Assembly assembly ) : DbUp.Builder.UpgradeEngineBuilder

Adds all scripts found as embedded resources in the given assembly, or classes which inherit from IScript, with a custom filter (you'll need to exclude non- .SQL files yourself).

WithScriptsAndCodeEmbeddedInAssembly ( this builder, Assembly assembly, bool>.Func filter ) : DbUp.Builder.UpgradeEngineBuilder

Adds all scripts found as embedded resources in the given assembly, or classes which inherit from IScript, with a custom filter (you'll need to exclude non- .SQL files yourself).

WithScriptsEmbeddedInAssemblies ( this builder, Assembly assemblies ) : DbUp.Builder.UpgradeEngineBuilder

Adds all scripts ending in '.sql' found as embedded resources in the given assemblies, using the default Encoding.

WithScriptsEmbeddedInAssemblies ( this builder, Assembly assemblies, Encoding encoding ) : DbUp.Builder.UpgradeEngineBuilder

Adds all scripts ending in '.sql' found as embedded resources in the given assemblies, using the specified Encoding.

WithScriptsEmbeddedInAssemblies ( this builder, Assembly assemblies, bool>.Func filter ) : DbUp.Builder.UpgradeEngineBuilder

Adds all scripts matching the specified filter found as embedded resources in the given assemblies, using the default Encoding.

WithScriptsEmbeddedInAssemblies ( this builder, Assembly assemblies, bool>.Func filter, Encoding encoding ) : DbUp.Builder.UpgradeEngineBuilder

Adds all scripts found as embedded resources in the given assemblies, with a custom filter (you'll need to exclude non- .SQL files yourself).

WithScriptsEmbeddedInAssembly ( this builder, Assembly assembly ) : DbUp.Builder.UpgradeEngineBuilder

Adds all scripts found as embedded resources in the given assembly.

WithScriptsEmbeddedInAssembly ( this builder, Assembly assembly, Encoding encoding ) : DbUp.Builder.UpgradeEngineBuilder

Adds all scripts found as embedded resources in the given assembly, with custom encoding.

WithScriptsEmbeddedInAssembly ( this builder, Assembly assembly, bool>.Func filter ) : DbUp.Builder.UpgradeEngineBuilder

Adds all scripts found as embedded resources in the given assembly, with a custom filter (you'll need to exclude non- .SQL files yourself).

WithScriptsEmbeddedInAssembly ( this builder, Assembly assembly, bool>.Func filter, Encoding encoding ) : DbUp.Builder.UpgradeEngineBuilder

Adds all scripts found as embedded resources in the given assembly, with custom encoding and with a custom filter (you'll need to exclude non- .SQL files yourself).

WithScriptsFromFileSystem ( this builder, string path ) : DbUp.Builder.UpgradeEngineBuilder

Adds all scripts from a folder on the file system.

WithScriptsFromFileSystem ( this builder, string path, Encoding encoding ) : DbUp.Builder.UpgradeEngineBuilder

Adds all scripts from a folder on the file system, with custom encoding.

WithScriptsFromFileSystem ( this builder, string path, FileSystemScriptOptions options ) : DbUp.Builder.UpgradeEngineBuilder

Adds all scripts from a folder on the file system, with custom options (Encoding, filter, etc.).

WithScriptsFromFileSystem ( this builder, string path, bool>.Func filter ) : DbUp.Builder.UpgradeEngineBuilder

Adds all scripts from a folder on the file system, with a custom filter.

WithScriptsFromFileSystem ( this builder, string path, bool>.Func filter, Encoding encoding ) : DbUp.Builder.UpgradeEngineBuilder

Adds all scripts from a folder on the file system, with a custom filter and custom encoding.

WithTransaction ( this builder ) : DbUp.Builder.UpgradeEngineBuilder

Run DbUp in a single transaction

WithTransactionPerScript ( this builder ) : DbUp.Builder.UpgradeEngineBuilder

Run each script in it's own transaction

WithVariable ( this builder, string variableName, string value ) : DbUp.Builder.UpgradeEngineBuilder

Adds a single variable that will be replaced before scripts are executed.

WithVariables ( this builder, string>.IDictionary variables ) : DbUp.Builder.UpgradeEngineBuilder

Adds a set of variables that will be replaced before scripts are executed.

WithVariablesDisabled ( this builder ) : DbUp.Builder.UpgradeEngineBuilder

Sets a configuration flag which will cause the engine to skip variable expansion.

WithVariablesEnabled ( this builder ) : DbUp.Builder.UpgradeEngineBuilder

Sets a configuration flag which will cause the engine to perform variable expansion.

WithoutTransaction ( this builder ) : DbUp.Builder.UpgradeEngineBuilder

Run creates a new connection for each script, without a transaction

Method Details

JournalTo() public static method

Uses a custom journal for recording which scripts were executed.
public static JournalTo ( this builder, IJournal journal ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
journal IJournal The custom journal.
return DbUp.Builder.UpgradeEngineBuilder

LogScriptOutput() public static method

Logs to the console using pretty colours.
public static LogScriptOutput ( this builder ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
return DbUp.Builder.UpgradeEngineBuilder

LogTo() public static method

Logs to a custom logger.
public static LogTo ( this builder, IUpgradeLog log ) : DbUp.Builder.UpgradeEngineBuilder
builder this
log IUpgradeLog The logger.
return DbUp.Builder.UpgradeEngineBuilder

LogToConsole() public static method

Logs to the console using pretty colours.
public static LogToConsole ( this builder ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
return DbUp.Builder.UpgradeEngineBuilder

LogToSqlContext() public static method

Logs to SqlContext.Pipe, for use with "context connection=true".
public static LogToSqlContext ( this builder ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
return DbUp.Builder.UpgradeEngineBuilder

LogToTrace() public static method

Logs to System.Diagnostics.Trace.
public static LogToTrace ( this builder ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
return DbUp.Builder.UpgradeEngineBuilder

WithExecutionTimeout() public static method

Allows you to set the execution timeout for scripts.
Setting the timeout parameter to null will use the default timeout of the underlying provider.
The timeout value is less than zero or greater than 2,147,483,647 seconds.
public static WithExecutionTimeout ( this builder, TimeSpan timeout ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
timeout TimeSpan A TimeSpan value containing the timeout value or null.
return DbUp.Builder.UpgradeEngineBuilder

WithPreprocessor() public static method

Adds a preprocessor that can replace portions of a script.
public static WithPreprocessor ( this builder, IScriptPreprocessor preprocessor ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
preprocessor IScriptPreprocessor The preprocessor.
return DbUp.Builder.UpgradeEngineBuilder

WithScript() public static method

Adds a single static script to the upgrader.
public static WithScript ( this builder, DbUp.Engine.SqlScript script ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
script DbUp.Engine.SqlScript The script.
return DbUp.Builder.UpgradeEngineBuilder

WithScript() public static method

Adds a single static script to the upgrader.
public static WithScript ( this builder, string name, string contents ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
name string The name of the script. This should never change once executed.
contents string The script body.
return DbUp.Builder.UpgradeEngineBuilder

WithScripts() public static method

Adds a static set of scripts to the upgrader.
public static WithScripts ( this builder ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
return DbUp.Builder.UpgradeEngineBuilder

WithScripts() public static method

Adds a static set of scripts to the upgrader.
public static WithScripts ( this builder, IEnumerable scripts ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
scripts IEnumerable The scripts.
return DbUp.Builder.UpgradeEngineBuilder

WithScripts() public static method

Adds a custom script provider to the upgrader.
public static WithScripts ( this builder, IScriptProvider scriptProvider ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
scriptProvider IScriptProvider The script provider.
return DbUp.Builder.UpgradeEngineBuilder

WithScriptsAndCodeEmbeddedInAssembly() public static method

Adds all scripts found as embedded resources in the given assembly, or classes which inherit from IScript, with a custom filter (you'll need to exclude non- .SQL files yourself).
public static WithScriptsAndCodeEmbeddedInAssembly ( this builder, Assembly assembly ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
assembly Assembly The assembly.
return DbUp.Builder.UpgradeEngineBuilder

WithScriptsAndCodeEmbeddedInAssembly() public static method

Adds all scripts found as embedded resources in the given assembly, or classes which inherit from IScript, with a custom filter (you'll need to exclude non- .SQL files yourself).
public static WithScriptsAndCodeEmbeddedInAssembly ( this builder, Assembly assembly, bool>.Func filter ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
assembly Assembly The assembly.
filter bool>.Func The Sql Script filter (only affects embdeeded scripts, does not filter IScript files). Don't forget to ignore any non- .SQL files.
return DbUp.Builder.UpgradeEngineBuilder

WithScriptsEmbeddedInAssemblies() public static method

Adds all scripts ending in '.sql' found as embedded resources in the given assemblies, using the default Encoding.
public static WithScriptsEmbeddedInAssemblies ( this builder, Assembly assemblies ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
assemblies Assembly The assemblies.
return DbUp.Builder.UpgradeEngineBuilder

WithScriptsEmbeddedInAssemblies() public static method

Adds all scripts ending in '.sql' found as embedded resources in the given assemblies, using the specified Encoding.
public static WithScriptsEmbeddedInAssemblies ( this builder, Assembly assemblies, Encoding encoding ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
assemblies Assembly The assemblies.
encoding Encoding The encoding.
return DbUp.Builder.UpgradeEngineBuilder

WithScriptsEmbeddedInAssemblies() public static method

Adds all scripts matching the specified filter found as embedded resources in the given assemblies, using the default Encoding.
public static WithScriptsEmbeddedInAssemblies ( this builder, Assembly assemblies, bool>.Func filter ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
assemblies Assembly The assemblies.
filter bool>.Func The filter. Don't forget to ignore any non- .SQL files.
return DbUp.Builder.UpgradeEngineBuilder

WithScriptsEmbeddedInAssemblies() public static method

Adds all scripts found as embedded resources in the given assemblies, with a custom filter (you'll need to exclude non- .SQL files yourself).
public static WithScriptsEmbeddedInAssemblies ( this builder, Assembly assemblies, bool>.Func filter, Encoding encoding ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
assemblies Assembly The assemblies.
filter bool>.Func The filter. Don't forget to ignore any non- .SQL files.
encoding Encoding The encoding.
return DbUp.Builder.UpgradeEngineBuilder

WithScriptsEmbeddedInAssembly() public static method

Adds all scripts found as embedded resources in the given assembly.
public static WithScriptsEmbeddedInAssembly ( this builder, Assembly assembly ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
assembly Assembly The assembly.
return DbUp.Builder.UpgradeEngineBuilder

WithScriptsEmbeddedInAssembly() public static method

Adds all scripts found as embedded resources in the given assembly, with custom encoding.
public static WithScriptsEmbeddedInAssembly ( this builder, Assembly assembly, Encoding encoding ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
assembly Assembly The assembly.
encoding Encoding The encoding.
return DbUp.Builder.UpgradeEngineBuilder

WithScriptsEmbeddedInAssembly() public static method

Adds all scripts found as embedded resources in the given assembly, with a custom filter (you'll need to exclude non- .SQL files yourself).
public static WithScriptsEmbeddedInAssembly ( this builder, Assembly assembly, bool>.Func filter ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
assembly Assembly The assembly.
filter bool>.Func The filter. Don't forget to ignore any non- .SQL files.
return DbUp.Builder.UpgradeEngineBuilder

WithScriptsEmbeddedInAssembly() public static method

Adds all scripts found as embedded resources in the given assembly, with custom encoding and with a custom filter (you'll need to exclude non- .SQL files yourself).
public static WithScriptsEmbeddedInAssembly ( this builder, Assembly assembly, bool>.Func filter, Encoding encoding ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
assembly Assembly The assembly.
filter bool>.Func The filter. Don't forget to ignore any non- .SQL files.
encoding Encoding The encoding.
return DbUp.Builder.UpgradeEngineBuilder

WithScriptsFromFileSystem() public static method

Adds all scripts from a folder on the file system.
public static WithScriptsFromFileSystem ( this builder, string path ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
path string The directory path.
return DbUp.Builder.UpgradeEngineBuilder

WithScriptsFromFileSystem() public static method

Adds all scripts from a folder on the file system, with custom encoding.
public static WithScriptsFromFileSystem ( this builder, string path, Encoding encoding ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
path string The directory path.
encoding Encoding The encoding.
return DbUp.Builder.UpgradeEngineBuilder

WithScriptsFromFileSystem() public static method

Adds all scripts from a folder on the file system, with custom options (Encoding, filter, etc.).
public static WithScriptsFromFileSystem ( this builder, string path, FileSystemScriptOptions options ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
path string The directory path.
options FileSystemScriptOptions Options for the file System Provider
return DbUp.Builder.UpgradeEngineBuilder

WithScriptsFromFileSystem() public static method

Adds all scripts from a folder on the file system, with a custom filter.
public static WithScriptsFromFileSystem ( this builder, string path, bool>.Func filter ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
path string The directory path.
filter bool>.Func The filter. Use the static class to get some pre-defined filters.
return DbUp.Builder.UpgradeEngineBuilder

WithScriptsFromFileSystem() public static method

Adds all scripts from a folder on the file system, with a custom filter and custom encoding.
public static WithScriptsFromFileSystem ( this builder, string path, bool>.Func filter, Encoding encoding ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
path string The directory path.
filter bool>.Func The filter. Use the static class to get some pre-defined filters.
encoding Encoding The encoding.
return DbUp.Builder.UpgradeEngineBuilder

WithTransaction() public static method

Run DbUp in a single transaction
public static WithTransaction ( this builder ) : DbUp.Builder.UpgradeEngineBuilder
builder this
return DbUp.Builder.UpgradeEngineBuilder

WithTransactionPerScript() public static method

Run each script in it's own transaction
public static WithTransactionPerScript ( this builder ) : DbUp.Builder.UpgradeEngineBuilder
builder this
return DbUp.Builder.UpgradeEngineBuilder

WithVariable() public static method

Adds a single variable that will be replaced before scripts are executed.
public static WithVariable ( this builder, string variableName, string value ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
variableName string The name of the variable.
value string The value to be substituted.
return DbUp.Builder.UpgradeEngineBuilder

WithVariables() public static method

Adds a set of variables that will be replaced before scripts are executed.
public static WithVariables ( this builder, string>.IDictionary variables ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
variables string>.IDictionary The variables.
return DbUp.Builder.UpgradeEngineBuilder

WithVariablesDisabled() public static method

Sets a configuration flag which will cause the engine to skip variable expansion.
public static WithVariablesDisabled ( this builder ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
return DbUp.Builder.UpgradeEngineBuilder

WithVariablesEnabled() public static method

Sets a configuration flag which will cause the engine to perform variable expansion.
public static WithVariablesEnabled ( this builder ) : DbUp.Builder.UpgradeEngineBuilder
builder this The builder.
return DbUp.Builder.UpgradeEngineBuilder

WithoutTransaction() public static method

Run creates a new connection for each script, without a transaction
public static WithoutTransaction ( this builder ) : DbUp.Builder.UpgradeEngineBuilder
builder this
return DbUp.Builder.UpgradeEngineBuilder