예제 #1
0
 public RuntimeConfiguration(ProviderInfo providerInfo, ConnectionInfo connectionInfo, IValidator validator, ISqlDispatcher sqlDispatcher)
 {
     _providerInfo = providerInfo;
     _connectionInfo = connectionInfo;
     _validator = validator;
     _sqlDispatcher = sqlDispatcher;
 }
예제 #2
0
        internal void Execute(ProviderInfo providerInfo, IDbConnection connection, IDbTransaction transaction, MigrationDirection direction, IDbCommandExecutor commandExecutor)
        {
            Debug.Assert(connection.State == ConnectionState.Open);

            var context = new RuntimeContext(connection, transaction, commandExecutor, providerInfo.Metadata, _stepMetadata);
            Database database = GetDatabaseContainingMigrationChanges(direction, context);
            var translator = new CommandsToSqlTranslator(providerInfo.Provider);
            foreach (string commandText in translator.TranslateToSql(database, context))
            {
                IDbCommand command = connection.CreateCommand();
                command.CommandTimeout = 0; // do not timeout; the client is responsible for not causing lock-outs
                command.Transaction = transaction;
                command.CommandText = commandText;
                try
                {
                    commandExecutor.ExecuteNonQuery(command);
                }
                catch (DbException x)
                {
                    Log.Error("An error occurred: {0}{1}while trying to execute:{1}{2}", x.Message, Environment.NewLine, command.CommandText);
                    throw;
                }
            }
        }
예제 #3
0
 public ValidatorFactory(ProviderInfo providerInfo, DbAltererOptions options, ProviderLocator providerLocator)
 {
     _providerInfo = providerInfo;
     _options = options;
     _providerLocator = providerLocator;
 }
예제 #4
0
 internal static void Initialize(MigrationOptions options, ProviderInfo providerInfo)
 {
     _options = options;
     _providerInfo = providerInfo;
 }