コード例 #1
0
        public TaskExecutor(IRunnerContext runnerContext, AssemblyLoaderFactory assemblyLoaderFactory, MigrationProcessorFactoryProvider processorFactoryProvider)
        {
            if (runnerContext == null) throw new ArgumentNullException("runnerContext");
            if (assemblyLoaderFactory == null) throw new ArgumentNullException("assemblyLoaderFactory");

            RunnerContext = runnerContext;
            AssemblyLoaderFactory = assemblyLoaderFactory;
            ProcessorFactoryProvider = processorFactoryProvider;
        }
コード例 #2
0
ファイル: Migrator.cs プロジェクト: Chillisoft/habanero
 private IMigrationProcessorFactory GetMigrationProcessorFactory(IDatabaseConfig databaseConfig)
 {
     string processorName;
     var vendor = databaseConfig.Vendor;
     if (!DatabaseProcessorMapping.TryGetValue(vendor.ToUpper(), out processorName))
     {
         throw new Exception(string.Format("The vendor '{0}' processor type has not been set up for Habanero Test Migrations.", vendor));
     }
     var migrationProcessorFactoryProvider = new MigrationProcessorFactoryProvider();
     return migrationProcessorFactoryProvider.GetFactory(processorName);
 }
コード例 #3
0
ファイル: Migrator.cs プロジェクト: jladuval/CQRSTemplate
        private static IMigrationProcessor BuildMigrationProcessor(string database, string connection, int timeout, IAnnouncer announcer, bool previewOnly)
        {
            var processorFactoryProvider = new MigrationProcessorFactoryProvider();
            var processorFactory = processorFactoryProvider.GetFactory(database);

            var processorOptions = new ProcessorOptions
            {
                Timeout = timeout,
                PreviewOnly = previewOnly
            };

            var processor = processorFactory.Create(connection, announcer, processorOptions);
            return processor;
        }
 public void Setup()
 {
     migrationProcessorFactoryProvider = new MigrationProcessorFactoryProvider();
 }
コード例 #5
0
        /// <summary>
        /// The schema sync main method.
        /// </summary>
        /// <param name="runnerAction">The runner action.</param>
        // TODO: Update table and column names to lowercase
        public void Sync(Action<IMigrationRunner> runnerAction)
        {
            // Announcer
            var announcer = new TextWriterAnnouncer(x => Log.Debug(x));

            // Assembly
            var assembly = Assembly.GetExecutingAssembly();

            // Migration context
            var context = new RunnerContext(announcer) { ApplicationContext = schemaType };

            // Processor
            var factory = new MigrationProcessorFactoryProvider().GetFactory(dbType);
            var options = new SchemaSyncOptions { PreviewOnly = false, Timeout = 0 };
            var processor = factory.Create(connectionString, announcer, options);

            // Runner
            var runner = new MigrationRunner(assembly, context, processor);

            try
            {
                runnerAction(runner);
            }
            catch (Exception ex)
            {
                Log.Error("[migration]::[runner]::[sync] Unexpected error during data schema sync", ex);
            }
        }