Example #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IMigrationRunner migrationRunner, IAgentsRepositorySingle agentsRepository)
        {
            migrationRunner.MigrateUp();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }


            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });

            var AgentsJob = new AgentsJob(agentsRepository);

            AgentsJob.Delete();
            AgentsJob.Execute(null);
        }
Example #2
0
 public ProfileLoader(IRunnerContext runnerContext, IMigrationRunner runner, IMigrationRunnerConventions conventions)
 {
     _runner          = runner;
     _conventions     = conventions;
     _serviceProvider = null;
     Profiles         = FindProfilesIn(runner.MigrationAssemblies, runnerContext.Profile).ToList();
 }
Example #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IMigrationRunner migrationRunner)
        {
            app.UseSwagger();

            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Teste Younder");
                c.RoutePrefix = string.Empty;
            });

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseCors(opt => opt.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());

            app.UseMvc();

            migrationRunner.MigrateUp();

            var context = ServiceProvider.GetRequiredService <FuncionarioRepository>();

            DataSample.Initialize(context);
        }
Example #4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IMigrationRunner migrationRunner)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });

            // запускаем миграции
            migrationRunner.MigrateUp();
            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "API сервиса агента сбора метрик");
                c.RoutePrefix = string.Empty;
            });
        }
Example #5
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IMigrationRunner migrationRunner)
        {
            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.RoutePrefix = string.Empty;
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "BeltsAndLeaders.Server");
            });

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            // app.UseHttpsRedirection();
            app.UseRouting();
            app.UseHttpExceptionHandling();
            // app.UseAuthorization();

            app.UseCors(this.allowOriginsPolicyName);

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });

            Database.Create();
            Database.Migrate(migrationRunner);
        }
Example #6
0
 private static void MigrateDown(int?version, IMigrationRunner runner)
 {
     if (version.HasValue && runner.HasMigrationsToApplyDown(version.Value))
     {
         runner.MigrateDown(version.Value);
     }
 }
 public TestVersionLoader(IMigrationRunner runner, VersionTableInfo.IVersionTableMetaData versionTableMetaData)
 {
     this.versionTableMetaData = versionTableMetaData;
     this.Runner = runner;
     this.VersionInfo = new VersionInfo();
     this.Versions = new List<long>();
 }
Example #8
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IMigrationRunner runner)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });

            runner.MigrateUp();
        }
        internal FxVersionLoader(IMigrationRunner runner, IAssemblyCollection assemblies,
                                 IConventionSet conventionSet,
                                 IMigrationRunnerConventions conventions,
                                 IRunnerContext runnerContext,
                                 IVersionTableMetaData versionTableMetaData = null,
                                 string resource = "")
        {
            _conventionSet = conventionSet;
            _processor     = runner.Processor;

            Runner     = runner;
            Assemblies = assemblies;

            Conventions                 = conventions;
            VersionTableMetaData        = versionTableMetaData ?? CreateVersionTableMetaData(runnerContext);
            VersionMigration            = new VersionMigration(VersionTableMetaData);
            VersionSchemaMigration      = new VersionSchemaMigration(VersionTableMetaData);
            VersionUniqueMigration      = new VersionUniqueMigration(VersionTableMetaData);
            VersionDescriptionMigration = new VersionDescriptionMigration(VersionTableMetaData);
            VersionResourceMigration    = new VersionResourceMigration(VersionTableMetaData);

            VersionTableMetaData.ApplicationContext = runnerContext.ApplicationContext;

            Resource = resource;

            LoadVersionInfo();
        }
        public FxVersionLoader(
            IProcessorAccessor processorAccessor,
            IConventionSet conventionSet,
            IMigrationRunnerConventions conventions,
            IVersionTableMetaData versionTableMetaData,
            IMigrationRunner runner,
            string resource = "")
        {
            _conventionSet = conventionSet;
            _processor     = processorAccessor.Processor;

            Runner = runner;

            Conventions                 = conventions;
            VersionTableMetaData        = versionTableMetaData;
            VersionMigration            = new VersionMigration(VersionTableMetaData);
            VersionSchemaMigration      = new VersionSchemaMigration(VersionTableMetaData);
            VersionUniqueMigration      = new VersionUniqueMigration(VersionTableMetaData);
            VersionDescriptionMigration = new VersionDescriptionMigration(VersionTableMetaData);
            VersionResourceMigration    = new VersionResourceMigration(VersionTableMetaData);

            Resource = resource;

            LoadVersionInfo();
        }
Example #11
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IMigrationRunner migrationRunner)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseResponseCompression();
            app.UseHttpsRedirection();

            app.UseRouting();
            app.UseCors(x =>
                        x.AllowAnyOrigin()
                        .AllowAnyMethod()
                        .AllowAnyHeader());

            EnableDocumentation(app);

            //app.UseAuthentication();
            //app.UseAuthorization();

            app.UseEndpoints(endpoints => endpoints.MapControllers());

            migrationRunner.MigrateUp();
        }
Example #12
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IMigrationRunner migrationRunner)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            //app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });

            migrationRunner.MigrateUp();

            // Включение middleware в пайплайн для обработки Swagger запросов.
            app.UseSwagger();
            // включение middleware для генерации swagger-ui
            // указываем Swagger JSON эндпоинт (куда обращаться за сгенерированной спецификацией
            // по которой будет построен UI).
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "API сервиса агента сбора метрик");
                c.RoutePrefix = string.Empty;
            });
        }
Example #13
0
        protected void Application_Start()
        {
            log4net.Config.XmlConfigurator.Configure();



            UnityServiceLocator serviceLocator  = new UnityServiceLocator(UnityConfig.GetConfiguredContainer());
            ICultureService     cultureService  = serviceLocator.GetInstance <ICultureService>();
            ISettingsService    settingsService = serviceLocator.GetInstance <ISettingsService>();

            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);



            RouteConfig.RegisterRoutes(RouteTable.Routes, cultureService);
            BundleConfig.RegisterBundles(BundleTable.Bundles);



            IMigrationRunner migrationRunner = serviceLocator.GetInstance <IMigrationRunner>();

            migrationRunner.Update();
        }
Example #14
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IMigrationRunner migrationRunner)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            app.UseHttpsRedirection();

            app.UseCors(opt => opt.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());

            app.UseSwagger();

            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Teste Younder");
                c.RoutePrefix = string.Empty;
            });

            app.UseAuthentication();
            app.UseStaticFiles();
            app.UseMvcWithDefaultRoute();

            migrationRunner.MigrateUp();
        }
Example #15
0
        public static void CreateTable()
        {
            var provider = CreateServiceProvider();

            Runner = provider.CreateScope().ServiceProvider.GetRequiredService <IMigrationRunner>();
            Runner.MigrateUp();
        }
Example #16
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IMigrationRunner migrationRunner, IDbConnectionFactory factory)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapBlazorHub();
                endpoints.MapFallbackToPage("/_Host");
            });

            // Run database migrations
            migrationRunner.MigrateUp();
        }
Example #17
0
 public FluentDatabaseMigrator(
     IMigrationRunner migrationRunner,
     ILogger <FluentDatabaseMigrator> logger)
 {
     _migrationRunner = migrationRunner;
     _logger          = logger;
 }
Example #18
0
        public MigrationManager(
            IFilteringMigrationSource filteringMigrationSource,
            IMigrationRunner migrationRunner,
            IMigrationRunnerConventions migrationRunnerConventions,
            IMigrationContext migrationContext,
            ITypeFinder typeFinder,
            IVersionLoader versionLoader)
        {
            _typeMapping = new Dictionary <Type, Action <ICreateTableColumnAsTypeSyntax> >()
            {
                [typeof(int)]      = c => c.AsInt32(),
                [typeof(string)]   = c => c.AsString(int.MaxValue).Nullable(),
                [typeof(bool)]     = c => c.AsBoolean(),
                [typeof(decimal)]  = c => c.AsDecimal(18, 4),
                [typeof(DateTime)] = c => c.AsDateTime2(),
                [typeof(byte[])]   = c => c.AsBinary(int.MaxValue),
                [typeof(Guid)]     = c => c.AsGuid()
            };

            _filteringMigrationSource   = filteringMigrationSource;
            _migrationRunner            = migrationRunner;
            _migrationRunnerConventions = migrationRunnerConventions;
            _migrationContext           = migrationContext;
            _typeFinder    = typeFinder;
            _versionLoader = versionLoader;
        }
 public TestVersionLoader(IMigrationRunner runner, VersionTableInfo.IVersionTableMetaData versionTableMetaData)
 {
     this.versionTableMetaData = versionTableMetaData;
     this.Runner = runner;
     this.AppliedVersions = new AppliedVersions();
     this.Versions = new List<IVersionInfo>();
 }
Example #20
0
 public TestVersionLoader(IMigrationRunner runner, IVersionTableMetaData versionTableMetaData)
 {
     this.versionTableMetaData = versionTableMetaData;
     Runner      = runner;
     VersionInfo = new VersionInfo();
     Versions    = new List <long>();
 }
Example #21
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IMigrationRunner migrationRunner)
        {
            migrationRunner.MigrateUp();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();
            app.UseHealthChecks("/check");

            app.UseSession();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapRazorPages();
            });
        }
Example #22
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IMigrationRunner migrationRunner)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            app.UseHttpsRedirection();

            app.UseSwagger();
            app.UseSwaggerUI(s =>
            {
                s.SwaggerEndpoint($"/swagger/v{Version}/swagger.json", "Praxio API");
            });

            app.UseAuthentication();
            app.UseStaticFiles();
            app.UseMvcWithDefaultRoute();

            migrationRunner.MigrateUp();
        }
        public CollectionMigrationRunner(
            IMongoMigrationSettings settings,
            ICollectionLocator collectionLocator,
            IVersionService versionService,
            IMigrationRunner migrationRunner)
            : this(
                collectionLocator,
                versionService,
                migrationRunner)
        {
            if (settings.ConnectionString == null && settings.Database == null || settings.ClientSettings == null)
            {
                throw new MongoMigrationNoMongoClientException();
            }

            if (settings.ClientSettings != null)
            {
                _client = new MongoClient(settings.ClientSettings);
            }
            else
            {
                _client = new MongoClient(settings.ConnectionString);
            }

            _databaseName = settings.Database;
        }
 public VersionLoader(IMigrationRunner runner, Assembly assembly, IMigrationConventions conventions)
 {
     Runner = runner;
     Processor = runner.Processor;
     Assembly = assembly;
     Conventions = conventions;
 }
Example #25
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env,
                              IMigrationRunner migrationRunner, UserManager <IdentityUser> userManager, RoleManager <IdentityRole> roleManager)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Error");
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();

            InitializeDatabase(app, migrationRunner);

            SetUpDefaultUsersAndRoles(userManager, roleManager).Wait();

            app.UseAuthentication();

            app.UseMvc();
        }
Example #26
0
        public void Configure(IApplicationBuilder app, IMigrationRunner migrationRunner, IFeatureManager featureManager)
        {
            app.UseForwardedHeaders(
                new ForwardedHeadersOptions
            {
                ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto,
            }
                );

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }

            app.UseExceptionHandler("/LearningSolutions/Error");
            app.UseStatusCodePagesWithReExecute("/LearningSolutions/StatusCode/{0}");
            app.UseStaticFiles();
            app.UseSerilogRequestLogging();
            app.UseRouting();
            app.UseAuthentication();
            app.UseAuthorization();

            app.UseSession();

            app.UseEndpoints(
                endpoints =>
                endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}")
                );

            migrationRunner.MigrateUp();
        }
Example #27
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, IMigrationRunner runner)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHsts();
            }

            app.UseStaticFiles();

            app.UseRouting();
            app.UseCors();

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseMiddleware(typeof(DataRepoErrorHandler));

            app.UseEndpoints(endpoints => {
                endpoints.MapControllers();
            });

            runner.MigrateUp();
        }
Example #28
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IMigrationRunner migrationRunner)
        {
            // ��������� middleware � �������� ��� ��������� Swagger ��������.
            app.UseSwagger();
            // ��������� middleware ��� ��������� swagger-ui
            // ��������� Swagger JSON �������� (���� ���������� �� ��������������� �������������
            // �� ������� ����� �������� UI).
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "API ������� ������ ����� ������");
//                c.RoutePrefix = string.Empty;
            });

            migrationRunner.MigrateUp();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

//            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Example #29
0
        internal ConnectionlessVersionLoader(
            IMigrationRunner runner,
            IAssemblyCollection assemblies,
            IConventionSet conventionSet,
            IMigrationRunnerConventions conventions,
            IRunnerContext runnerContext,
            IVersionTableMetaData versionTableMetaData = null)
        {
            _migrationInformationLoader = runner.MigrationLoader;
            _processor = runner.Processor;

            Runner        = runner;
            Assemblies    = assemblies;
            Conventions   = conventions;
            StartVersion  = runnerContext.StartVersion;
            TargetVersion = runnerContext.Version;

            VersionInfo          = new VersionInfo();
            VersionTableMetaData = versionTableMetaData ??
                                   (IVersionTableMetaData)Activator.CreateInstance(assemblies.Assemblies.GetVersionTableMetaDataType(
                                                                                       Conventions, runnerContext));
            VersionMigration            = new VersionMigration(VersionTableMetaData);
            VersionSchemaMigration      = new VersionSchemaMigration(VersionTableMetaData);
            VersionUniqueMigration      = new VersionUniqueMigration(VersionTableMetaData);
            VersionDescriptionMigration = new VersionDescriptionMigration(VersionTableMetaData);

            if (VersionTableMetaData is DefaultVersionTableMetaData defaultMetaData)
            {
                conventionSet.SchemaConvention?.Apply(defaultMetaData);
            }

            LoadVersionInfo();
        }
Example #30
0
 /// <inheritdoc />
 public void ApplyProfiles(IMigrationRunner runner)
 {
     // Run Profile if applicable
     foreach (var profile in Profiles)
     {
         runner.Up(profile);
     }
 }
Example #31
0
 private void InitializeDatabase(IApplicationBuilder app, IMigrationRunner migrationRunner)
 {
     using (var scope = app.ApplicationServices.GetService <IServiceScopeFactory>().CreateScope())
     {
         scope.ServiceProvider.GetRequiredService <ApplicationDbContext>().Database.Migrate();
     }
     migrationRunner.MigrateUp();
 }
Example #32
0
 public AuthInitializer(ILogger <AuthInitializer> logger,
                        IMigrationRunner migrationRunner,
                        AuthContext context)
 {
     _logger          = logger;
     _migrationRunner = migrationRunner;
     _context         = context;
 }
Example #33
0
 public DefaultPluginEngine(IFileSystem fs, IDataRepository repo, IMessageBus mbus, IMigrationRunner runner, IPluginLoader[] loaders)
 {
     _fs = fs;
     _repo = repo;
     _mbus = mbus;
     _runner = runner;
     _loaders = loaders;
 }
        public static void DropSchema(this IMigrationRunner migrationRunner, IVersionTableMetaData versionTableMetaData)
        {
            var schemaName = versionTableMetaData.SchemaName;

            migrationRunner.Processor.Process(new DeleteSchemaExpression {
                SchemaName = schemaName
            });
        }
Example #35
0
        public ProfileLoader(IRunnerContext runnerContext, IMigrationRunner runner, IMigrationConventions conventions)
        {
            Runner = runner;
            Assembly = runner.MigrationAssembly;
            Profile = runnerContext.Profile;
            Conventions = conventions;

            Initialize();
        }
Example #36
0
        public ProfileLoader(IRunnerContext runnerContext, IMigrationRunner runner, IEnumerable<Assembly> assemblies, IMigrationConventions conventions)
        {
            Runner = runner;
            Assemblies = assemblies.ToList();
            Profile = runnerContext.Profile;
            Conventions = conventions;

            Initialize();
        }
Example #37
0
        public ProfileLoader(IRunnerContext runnerContext, IMigrationRunner runner, IMigrationConventions conventions, bool isBeforeProfile)
        {
            Runner = runner;
            Assembly = runner.MigrationAssembly;
            Profile = isBeforeProfile ? runnerContext.BeforeProfile : runnerContext.Profile;
            Conventions = conventions;

            Initialize();
        }
Example #38
0
   public Migrator(IMigrationSelector migrationSelector, IMigrationRunner migrationRunner,
 IDatabaseProvider databaseProvider, ISchemaStateManager schemaStateManager,
 IWorkingDirectoryManager workingDirectoryManager)
   {
       _migrationSelector = migrationSelector;
         _workingDirectoryManager = workingDirectoryManager;
         _schemaStateManager = schemaStateManager;
         _databaseProvider = databaseProvider;
         _migrationRunner = migrationRunner;
   }
Example #39
0
        public Migrator(MigratorContext context)
        {
            // Initialize runner context and migration processor
            var runnerContext = BuildRunnerContext(context.Announcer, context.Profile);
            var processor = BuildMigrationProcessor(context.Database, context.Connection, context.Timeout, context.Announcer, context.PreviewOnly);

            // Initialize migration runner
            var runner = BuildMigrationRunner(context.MigrationsAssembly, runnerContext, processor);
            _migrationRunner = runner;
        }
Example #40
0
 public DefaultPluginEngine(IFileSystem fileSystem,
     IMessageBus messageBus,
     IMigrationRunner migrationRunner,
     IPluginLoader[] pluginLoaders)
 {
     _fileSystem = fileSystem;
     _messageBus = messageBus;
     _migrationRunner = migrationRunner;
     _pluginLoaders = pluginLoaders;
 }
Example #41
0
        public DefaultHost(IDataRepository data, IBitTorrentEngine torrentEngine, IMigrationRunner runner, IPluginEngine pluginEngine, IHttpServer httpServer)
        {
            _data = data;
            _torrentEngine = torrentEngine;
            _migratorRunner = runner;
            _pluginEngine = pluginEngine;
            _httpServer = httpServer;

            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
        }
        public VersionLoader(IMigrationRunner runner, Assembly assembly, IMigrationConventions conventions)
        {
            Runner = runner;
            Processor = runner.Processor;
            Assembly = assembly;

            Conventions = conventions;
            VersionTableMetaData = GetVersionTableMetaData();
            VersionMigration = new VersionMigration(VersionTableMetaData);

            LoadVersionInfo();
        }
Example #43
0
        public VersionLoader(IMigrationRunner runner, IEnumerable<Assembly> assemblies, IMigrationConventions conventions)
        {
            Runner = runner;
            Processor = runner.Processor;
            Assemblies = assemblies.ToList();

            Conventions = conventions;
            VersionTableMetaData = GetVersionTableMetaData();
            VersionMigration = new VersionMigration(VersionTableMetaData);
            VersionSchemaMigration = new VersionSchemaMigration(VersionTableMetaData);

            LoadVersionInfo();
        }
Example #44
0
        public VersionLoader(IMigrationRunner runner, ICollection<MigrationAssemblyInfo> assemblies, IMigrationConventions conventions)
        {
            Runner = runner;
            Processor = runner.Processor;
            Assemblies = assemblies;

            Conventions = conventions;
            VersionTableMetaData = GetVersionTableMetaData();
            VersionMigration = new VersionMigration(VersionTableMetaData);
            VersionSchemaMigration = new VersionSchemaMigration(VersionTableMetaData);
            VersionUniqueMigration = new VersionUniqueMigration(VersionTableMetaData);

            LoadVersionInfo();
        }
 public MaintenanceLoader(IMigrationRunner runner, IMigrationConventions conventions)
 {
     _runner = runner;
     _maintenance = (
         from type in runner.MigrationAssembly.GetExportedTypes()
         let stage = conventions.GetMaintenanceStage(type)
         where stage != null
         let migration = (IMigration)Activator.CreateInstance(type)
         group migration by stage
     ).ToDictionary(
         g => g.Key.Value,
         g => (IList<IMigration>)g.OrderBy(m => m.GetType().Name).ToArray()
     );
 }
        private void ConfigureRunner()
        {
            var connectionString = ConfigurationManager.ConnectionStrings[connectionStringKey].ConnectionString;
            
            var announcer = GetAnnouncer();
            
            var migrationContext = new RunnerContext(announcer);

            if (migrationTags != null)
            {
                migrationContext.Tags = migrationTags;
            }

            var sqlProcessor = GetMigrationProcessor(connectionString, announcer);

            this.runner = new MigrationRunner(assembly, migrationContext, sqlProcessor);
        }
        public ConnectionlessVersionLoader(IMigrationRunner runner, IAssemblyCollection assemblies, IMigrationConventions conventions, long startVersion, long targetVersion)
        {
            Runner = runner;
            Assemblies = assemblies;
            Conventions = conventions;
            StartVersion = startVersion;
            TargetVersion = targetVersion;

            Processor = Runner.Processor;

            VersionInfo = new VersionInfo();
            VersionTableMetaData = GetVersionTableMetaData();
            VersionMigration = new VersionMigration(VersionTableMetaData);
            VersionSchemaMigration = new VersionSchemaMigration(VersionTableMetaData);
            VersionUniqueMigration = new VersionUniqueMigration(VersionTableMetaData);
            VersionDescriptionMigration = new VersionDescriptionMigration(VersionTableMetaData);

            LoadVersionInfo();
        }
Example #48
0
        internal DefaultPluginManager(PluginInfo info, IMessageBus mbus, IMigrationRunner runner, IPluginLoader[] loaders)
        {
            _info = info;

            _mbus = mbus;
            _runner = runner;
            _loaders = loaders;

            var loader = (from l in _loaders
                          where l.CanLoad(_info.Path)
                          select l).First();

            if (loader != null)
            {
                _pluginType = loader.Load(_info.Path).First();

                if (_pluginType == null)
                {
                    throw new ArgumentException("Could not find plugin type in given PluginInfo.Path", "info");
                }
            }
        }
 public FakeTaskExecutor(IRunnerContext runnerContext, IMigrationRunner runner)
     : base(runnerContext)
 {
     this.runner = runner;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultWebApplicationHost" /> class.
 /// </summary>
 /// <param name="modulesRegistration">The modules registration.</param>
 /// <param name="migrationRunner">The migration runner.</param>
 public DefaultWebApplicationHost(IWebModulesRegistration modulesRegistration, IMigrationRunner migrationRunner)
 {
 }
Example #51
0
 public VersionLoader(IMigrationRunner runner, Assembly assembly, IMigrationConventions conventions)
     : this(runner, new[] { assembly }, conventions)
 {
 }
 /// <summary>Get a profile loader.</summary>
 /// <param name="runnerContext">The runner metadata.</param>
 /// <param name="runner">The runner which executes migrations.</param>
 /// <param name="conventions">The default rules for migration mappings.</param>
 public virtual IProfileLoader GetProfileLoader(IRunnerContext runnerContext, IMigrationRunner runner, IMigrationConventions conventions)
 {
     return new ProfileLoader(runnerContext, runner, conventions);
 }
Example #53
0
 public ProfileLoader(IRunnerContext runnerContext, IMigrationRunner runner, Assembly assembly, IMigrationConventions conventions)
     : this(runnerContext, runner, new[] { assembly }, conventions)
 {
 }
Example #54
0
 public DefaultCmsHost(IWebModulesRegistration modulesRegistration, IMigrationRunner migrationRunner)
     : base(modulesRegistration, migrationRunner)
 {
 }
Example #55
0
 public DefaultCmsHost(IWebModulesRegistration modulesRegistration, IMigrationRunner migrationRunner, IRedirectControl redirectControl)
     : base(modulesRegistration, migrationRunner)
 {
     this.redirectControl = redirectControl;
 }
Example #56
0
 public Migrator(IMigrationSelector migrationSelector, IMigrationRunner migrationRunner, IWorkingDirectoryManager workingDirectoryManager)
 {
   _migrationSelector = migrationSelector;
   _workingDirectoryManager = workingDirectoryManager;
   _migrationRunner = migrationRunner;
 }
Example #57
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultCmsHost" /> class.
 /// </summary>
 /// <param name="modulesRegistration">The modules registration.</param>
 /// <param name="migrationRunner">The migration runner.</param>
 public DefaultCmsHost(IModulesRegistration modulesRegistration, IMigrationRunner migrationRunner)
 {
     this.modulesRegistration = modulesRegistration;
     this.migrationRunner = migrationRunner;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultWebApplicationHost" /> class.
 /// </summary>
 /// <param name="modulesRegistration">The modules registration.</param>
 /// <param name="migrationRunner">The migration runner.</param>
 public DefaultWebApplicationHost(IWebModulesRegistration modulesRegistration, IMigrationRunner migrationRunner)
 {
     this.modulesRegistration = modulesRegistration;
     this.migrationRunner = migrationRunner;
 }
Example #59
0
 public VersionLoader(IMigrationRunner runner, Assembly assembly, IMigrationConventions conventions)
   : this(runner, new SingleAssembly(assembly), conventions)
 {
 }
 /// <summary>Get an object which reads and writes database versions to the database.</summary>
 /// <param name="runner">The migration runner used to create the version table.</param>
 /// <param name="assembly">The assembly to scan for migrations.</param>
 /// <param name="conventions">The default rules for migration mappings.</param>
 /// <param name="applicationContext">The arbitrary application context passed to the task runner.</param>
 public virtual IVersionLoader GetVersionLoader(IMigrationRunner runner, Assembly assembly, IMigrationConventions conventions, object applicationContext)
 {
     return new VersionLoader(runner, assembly, conventions);
 }