示例#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, ProfilerPostgreSqlDbContext profilerPostgreSqlDbContext)
        {
            app.ApplyEasyProfilerPostgreSQL(profilerPostgreSqlDbContext);
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseRouting();

            app.UseSwagger();

            app.UseSwaggerUI(options =>
            {
                options.EnableDeepLinking();
                options.ShowExtensions();
                options.DisplayRequestDuration();
                options.DocExpansion(Swashbuckle.AspNetCore.SwaggerUI.DocExpansion.None);
                options.RoutePrefix = "api-docs";
                options.SwaggerEndpoint("/swagger/EasyProfiler/swagger.json", "EasyProfilerSwagger");
            });
            app.UseDocumentation(opts => this.Configuration.Bind("DocumentationOptions", opts));
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
 /// <summary>
 /// Database migration for SQL Server.
 /// </summary>
 /// <param name="app">
 /// IApplicationBuilder
 /// </param>
 /// <param name="postgreSqlDbContext">
 /// Profiler DbContext
 /// </param>
 public static void ApplyEasyProfilerPostgreSQL(this IApplicationBuilder app, ProfilerPostgreSqlDbContext postgreSqlDbContext)
 {
     postgreSqlDbContext.Database.Migrate();
 }