示例#1
0
        public TodoController(WhatsThatGameProdContext context)
        {
            _context = context;

            if (!_context.Game.Any())
            {
                //_context.Game.Add(new Game { Title = "TPA" , Description = "Pinball game" ,  Year = 2013});
                //_context.Game.Add(new Game { Title = "KCD" , Description = "Medieval game", Year = 2018 });
                //_context.SaveChanges();
            }
        }
示例#2
0
文件: Startup.cs 项目: Jibblol/.NET
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, WhatsThatGameProdContext db)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseStatusCodePages();
            }
            else
            {
                //app.UseHsts();
            }

            db.Database.Migrate();

            app.UseCors(builder => builder
                        .AllowAnyOrigin()
                        .AllowAnyMethod()
                        .AllowAnyHeader()
                        .AllowCredentials());

            // app.UseHttpsRedirection();

            app.UseMvc();
        }