コード例 #1
0
ファイル: Startup.cs プロジェクト: lybaokhanh/the-world
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app,
                              IHostingEnvironment env,
                              WorldContextSeedData seeder,
                              ILoggerFactory factory)
        {
            Mapper.Initialize(config => {
                config.CreateMap <TripViewModel, Trip>().ReverseMap();
                config.CreateMap <StopViewModel, Stop>().ReverseMap();
            });

            if (env.IsEnvironment("Development"))
            {
                app.UseDeveloperExceptionPage();
                factory.AddDebug(LogLevel.Information);
            }
            else
            {
                factory.AddDebug(LogLevel.Error);
            }

            app.UseStaticFiles();
            app.UseIdentity();

            app.UseMvc(config =>
            {
                config.MapRoute(
                    name: "Default",
                    template: "{controller}/{action}/{id?}",
                    defaults: new { controller = "App", action = "Index" }
                    );
            });

            seeder.EnsureData().Wait();
        }