示例#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, IApiVersionDescriptionProvider apiVersionDescriptionProvider)
        {
            //Here we can call the middleware for authentication, that way we give to the host the responsability to register
            //Auth stuff.

            ApiStartupConfiguration.Configure(
                app,
                host => host
                .UseIf(env.IsDevelopment(), appBuilder => appBuilder.UseDeveloperExceptionPage()),
                env,
                apiVersionDescriptionProvider,
                Configuration
                );
        }
示例#2
0
        public void ConfigureServices(IServiceCollection services)
        {
            #region Host related services
            //Here we can take advantage of the separartion of concern between host and WebApi and before call
            //the WebApi ConfigurationServices we can define the Authentication approach "for instance JWT", also
            //define the ErrorHandling approach (for instance through a middleware to keep clean the WebApi project in term of handling exceptions)
            #endregion

            #region WebApi related services

            //Using separation of conserns by solution architecture. This is good for instance for isolate Unit Tests, etc.

            ApiStartupConfiguration.ConfigureServices(services, Configuration, Env);

            #endregion
        }