コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AdHocSqlRunner"/> class.
 /// </summary>
 /// <param name="commandFactory">The command factory.</param>
 /// <param name="schema">The schema.</param>
 /// <param name="variablesEnabled">Function indicating <c>true</c> if variables should be replaced, <c>false</c> otherwise.</param>
 /// <param name="additionalScriptPreprocessors">The additional script preprocessors.</param>
 public AdHocSqlRunner(Func <IDbCommand> commandFactory, ISqlObjectParser sqlObjectParser, string schema, Func <bool> variablesEnabled, params IScriptPreprocessor[] additionalScriptPreprocessors)
 {
     this.commandFactory   = commandFactory;
     this.sqlObjectParser  = sqlObjectParser;
     this.variablesEnabled = variablesEnabled;
     this.additionalScriptPreprocessors = additionalScriptPreprocessors;
     Schema = schema;
 }
コード例 #2
0
 public DowngradeEnabledTableJournal(
     Func <IConnectionManager> connectionManager,
     Func <IUpgradeLog> logger,
     ISqlObjectParser sqlObjectParser,
     string schema,
     string table,
     IScriptProvider downgradeScriptsProvider)
     : base(connectionManager, logger, sqlObjectParser, schema, table)
 {
     _downgradeScripts        = downgradeScriptsProvider.GetScripts(connectionManager()).ToList();
     journalIsInLatestVersion = false;
 }
コード例 #3
0
 /// <summary>
 /// Initializes an instance of the <see cref="SqlScriptExecutor"/> class.
 /// </summary>
 /// <param name="connectionManagerFactory"></param>
 /// <param name="log">The logging mechanism.</param>
 /// <param name="schema">The schema that contains the table.</param>
 /// <param name="variablesEnabled">Function that returns <c>true</c> if variables should be replaced, <c>false</c> otherwise.</param>
 /// <param name="scriptPreprocessors">Script Preprocessors in addition to variable substitution</param>
 /// <param name="journalFactory">Database journal</param>
 public ScriptExecutor(
     Func <IConnectionManager> connectionManagerFactory, ISqlObjectParser sqlObjectParser,
     Func <IUpgradeLog> log, string schema, Func <bool> variablesEnabled,
     IEnumerable <IScriptPreprocessor> scriptPreprocessors,
     Func <IJournal> journalFactory)
 {
     Schema = schema;
     Log    = log;
     this.variablesEnabled         = variablesEnabled;
     this.scriptPreprocessors      = scriptPreprocessors;
     this.journalFactory           = journalFactory;
     this.connectionManagerFactory = connectionManagerFactory;
     this.sqlObjectParser          = sqlObjectParser;
 }
コード例 #4
0
        protected HashingTableJournal(
            Func <IConnectionManager> connections,
            Func <IUpgradeLog> logger,
            ISqlObjectParser sqlObjectParser,
            string schemaName,
            string tableName)
        {
            Connections     = connections;
            Log             = logger;
            SqlObjectParser = sqlObjectParser;

            UnquotedTableSchema = schemaName ?? "dbo";
            UnquotedTableName   = tableName ?? "SchemaVersionHash";
        }
コード例 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TableJournal"/> class.
 /// </summary>
 /// <param name="connectionManager">The connection manager.</param>
 /// <param name="logger">The log.</param>
 /// <param name="sqlObjectParser"></param>
 /// <param name="schema">The schema that contains the table.</param>
 /// <param name="table">The table name.</param>
 protected TableJournal(
     Func <IConnectionManager> connectionManager,
     Func <IUpgradeLog> logger,
     ISqlObjectParser sqlObjectParser,
     string schema, string table)
 {
     this.sqlObjectParser = sqlObjectParser;
     ConnectionManager    = connectionManager;
     Log = logger;
     UnquotedSchemaTableName = table;
     SchemaTableSchema       = schema;
     FqSchemaTableName       = string.IsNullOrEmpty(schema)
         ? sqlObjectParser.QuoteIdentifier(table)
         : sqlObjectParser.QuoteIdentifier(schema) + "." + sqlObjectParser.QuoteIdentifier(table);
 }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AdHocSqlRunner"/> class.
 /// </summary>
 /// <param name="commandFactory">The command factory.</param>
 /// <param name="schema">The schema.</param>
 /// <param name="additionalScriptPreprocessors">The additional script preprocessors.</param>
 /// <remarks>Sets the <c>variablesEnabled</c> setting to <c>true</c>.</remarks>
 public AdHocSqlRunner(Func <IDbCommand> commandFactory, ISqlObjectParser sqlObjectParser, string schema, params IScriptPreprocessor[] additionalScriptPreprocessors)
     : this(commandFactory, sqlObjectParser, schema, () => true, additionalScriptPreprocessors)
 {
 }
コード例 #7
0
 public HashedSqlTableJournal(Func <IConnectionManager> connectionManager, Func <IUpgradeLog> logger, string schema, string table)
     : base(connectionManager, logger, schema, table)
 {
     this._sqlObjectParser = new SqlServerObjectParser();
 }