Ejemplo n.º 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            app.UseHealthChecks("/health");
            loggerFactory.AddSerilog();

            app.UseForwardedHeaders(new ForwardedHeadersOptions
            {
                ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
            });

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                // 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.UseMvc();

            app.UseSwagger();
            app.UseSwaggerUI(c =>
            {
                c.RoutePrefix = string.Empty;
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "SmartHouse Gateway API V1");
                c.DisplayRequestDuration();
            });

            DbMigration.Migrate(app.ApplicationServices);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            var dbMigration = new DbMigration(new Logger());

            var logger    = new Logger();
            var installer = new Installer(logger);

            dbMigration.Migrate();
            installer.Install();
        }
Ejemplo n.º 3
0
        public static void Startup(Schema schema, ILogger <MigrationRunner> migrationLogger)
        {
            DbMigration.Migrate <DbMigrations.V001.V000.Rev0_CreateUserTable>(schema, migrationLogger);

            _sessionFactory = BuildSessionFactory(schema.ConnectionString);

            ExecutorAsync =
                new ValidatingExecutorAsync(
                    new RepositoryExecutorAsync(_sessionFactory, () => Repository.Value, r => Repository.Value = r,
                                                new ExecutorAsync()));
        }