示例#1
0
        //
        /// <summary>
        ///This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        /// </summary>
        /// <param name="app">The app.</param>
        /// <param name="env">The env.</param>
        /// <param name="application">The application.</param>
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IBApplication application)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            // 添加Swagger有关中间件
            app.IntertMiddle("swagger", Guid.Empty, 8, () => app.UseSwagger());
            app.IntertMiddle("swaggerUI", Guid.Empty, 8, () => app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Main v1");
            }));

            var log         = app.ApplicationServices.GetService <ILogger <Startup> >();
            var routeOption = app.ApplicationServices.GetService <IOptions <RouteOptions> >();

            routeOption.Value.SuppressCheckForUnhandledSecurityMetadata = true;
            if (application is BApplication t)
            {
                t.ServiceProvider = app.ApplicationServices;
                t.Builder         = app;
            }
            app.IntertMiddle("main-routing", Guid.Empty, 10, () => app.UseRouting());
            app.ConfigPlugin();
            app.IntertMiddle("main-endpoint", Guid.Empty, int.MaxValue, () => app.UseEndpoints(endpoints => endpoints.MapControllers()));
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TestController"/> class.
 /// </summary>
 /// <param name="pluginLoader">The plugin loader.</param>
 /// <param name="application">The application.</param>
 /// <param name="reflectorUtil">The reflector util.</param>
 /// <param name="pluginManagers">The plugin managers.</param>
 public TestController(
     IPluginLoader pluginLoader,
     IBApplication application,
     IReflectorUtil reflectorUtil,
     IPluginManagers pluginManagers)
 {
     this.pluginLoader   = pluginLoader;
     this.application    = application;
     this.reflectorUtil  = reflectorUtil;
     this.pluginManagers = pluginManagers;
 }