static void AutofacStartupConfig(ContainerBuilder containerBuilder) { #region GtkUI containerBuilder.RegisterType <GtkMessageDialogsInteractive>().As <IInteractiveMessage>(); containerBuilder.RegisterType <GtkQuestionDialogsInteractive>().As <IInteractiveQuestion>(); containerBuilder.RegisterType <GtkInteractiveService>().As <IInteractiveService>(); containerBuilder.RegisterType <GtkGuiDispatcher>().As <IGuiDispatcher>(); containerBuilder.RegisterType <GtkRunOperationService>().As <IRunOperationService>(); #endregion GtkUI #region Versioning containerBuilder.RegisterType <ApplicationVersionInfo>().As <IApplicationInfo>(); #endregion #region ErrorReporting containerBuilder.RegisterType <DesktopErrorReporter>().As <IErrorReporter>(); containerBuilder.RegisterType <LogService>().As <ILogService>(); #if DEBUG containerBuilder.Register(c => new ErrorReportingSettings(false, true, false, 300)).As <IErrorReportingSettings>(); #else containerBuilder.Register(c => new ErrorReportingSettings(true, false, true, 300)).As <IErrorReportingSettings>(); #endif containerBuilder.RegisterType <MySqlException1055OnlyFullGroupBy>().As <IErrorHandler>(); containerBuilder.RegisterType <MySqlException1366IncorrectStringValue>().As <IErrorHandler>(); containerBuilder.RegisterType <NHibernateFlushAfterException>().As <IErrorHandler>(); containerBuilder.RegisterType <ConnectionIsLost>().As <IErrorHandler>(); #endregion #region Обновления и версии containerBuilder.RegisterModule(new UpdaterAutofacModule()); containerBuilder.Register(c => ScriptsConfiguration.MakeUpdateConfiguration()).AsSelf(); containerBuilder.Register(c => ScriptsConfiguration.MakeCreationScript()).AsSelf(); #endregion #region Временные будут переопределены containerBuilder.RegisterType <GtkWindowsNavigationManager>().AsSelf().As <INavigationManager>().SingleInstance(); containerBuilder.Register((ctx) => new AutofacViewModelsGtkPageFactory(startupContainer)).As <IViewModelsPageFactory>(); containerBuilder.Register(cc => new ClassNamesBaseGtkViewResolver( typeof(UpdateProcessView) )).As <IGtkViewResolver>(); #endregion }
public void ApplyUpdatesTest(SqlServer server, DbSample sample) { var updateConfiguration = ScriptsConfiguration.MakeUpdateConfiguration(); //Проверяем нужно ли обновлять if (!updateConfiguration.GetHopsToLast(sample.TypedVersion).Any()) { Assert.Ignore($"Образец базы {sample} версии пропущен. Так как версию базы {sample.Version} невозможно обновить."); } //Создаем чистую базу StartSqlServer(server); var creator = new TestingCreateDbController(server); var success = creator.StartCreation(sample); Assert.That(success, Is.True); //Выполняем обновление var builder = server.ConnectionStringBuilder; builder.Database = sample.DbName; var connectionstring = builder.GetConnectionString(true); using (var connection = new MySqlConnection(connectionstring)) { connection.Open(); foreach (var hop in updateConfiguration.GetHopsToLast(sample.TypedVersion)) { TestContext.Progress.WriteLine($"Выполняем скрипт {hop.Source.VersionToShortString()} → {hop.Destination.VersionToShortString()}"); RunOneUpdate(connection, hop); } //Версии баз до 2.5 отличаются не принципиально, например порядком индексов, //Это не имеет смысл специально исправлять. Поэтому проверка этих версия пропущена. if (sample.TypedVersion >= new Version(2, 5)) { ComparisonSchema(connection, currentDdName, sample.DbName); } } }
public void SequenceCheckTest() { base.SequenceCheckTest(ScriptsConfiguration.MakeUpdateConfiguration()); }