예제 #1
0
        public static void Main(string[] args)
        {
            var host = BuildWebHost(args);

            using (var scope = host.Services.CreateScope())
            {
                var services = scope.ServiceProvider;
                var context  =
                    services.GetRequiredService <WishListContext>();
                WishListSeed.SeedAsync(context).Wait();
            }
            host.Run();
        }
예제 #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public async void Configure(IApplicationBuilder app, WishListSeed seedData)
        {
            app.UseStaticFiles();
            app.UseIdentity();
            app.UseIISPlatformHandler();
            Mapper.Initialize(config =>
            {
                config.CreateMap <VmWishList, WishList>().ReverseMap();
            });
            app.UseMvc(config =>
            {
                config.MapRoute(
                    name: "Default",
                    template: "{controller}/{action}/{id?}",
                    defaults: new { controller = "App", action = "Index" }
                    );
            });
            await seedData.EnsureSeedDone();

            //app.Run(async (context) =>
            //{
            //    await context.Response.WriteAsync("Hello World!");
            //});
        }