예제 #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)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                using (var serviceScope = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>()
                                          .CreateScope())
                {
                    ISeedDbService seed = serviceScope.ServiceProvider.GetService <ISeedDbService>();
                    seed.Seed();
                }
            }

            app.UseHttpsRedirection();
            //app.UseMvc();
            app.UseSwagger(c =>
            {
                c.RouteTemplate = "swagger/{documentName}/swagger.json";
            });
            app.UseSwaggerUI(s =>
            {
                s.SwaggerEndpoint("/swagger/v1/swagger.json", "Workiom Code Test v1.0");
            });
            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
예제 #2
0
 public SeedDbController(ISeedDbService service)
 {
     _service = service;
 }