C# Class StandardExtensions, DbUp

Configuration extensions for the standard stuff.
Afficher le fichier Open project: DbUp/DbUp Class Usage Examples

Méthodes publiques

Méthode 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 méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

LogScriptOutput() public static méthode

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

LogTo() public static méthode

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

LogToConsole() public static méthode

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

LogToSqlContext() public static méthode

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

LogToTrace() public static méthode

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

WithExecutionTimeout() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithPreprocessor() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithScript() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithScript() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithScripts() public static méthode

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

WithScripts() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithScripts() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithScriptsAndCodeEmbeddedInAssembly() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithScriptsAndCodeEmbeddedInAssembly() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithScriptsEmbeddedInAssemblies() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithScriptsEmbeddedInAssemblies() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithScriptsEmbeddedInAssemblies() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithScriptsEmbeddedInAssemblies() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithScriptsEmbeddedInAssembly() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithScriptsEmbeddedInAssembly() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithScriptsEmbeddedInAssembly() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithScriptsEmbeddedInAssembly() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithScriptsFromFileSystem() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithScriptsFromFileSystem() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithScriptsFromFileSystem() public static méthode

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
Résultat DbUp.Builder.UpgradeEngineBuilder

WithScriptsFromFileSystem() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithScriptsFromFileSystem() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithTransaction() public static méthode

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

WithTransactionPerScript() public static méthode

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

WithVariable() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithVariables() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithVariablesDisabled() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithVariablesEnabled() public static méthode

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.
Résultat DbUp.Builder.UpgradeEngineBuilder

WithoutTransaction() public static méthode

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