Example #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, DSMSDBContext context)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            //Ensure the DB is up to date
            if (!context.AllMigrationsApplied())
            {
                context.Database.Migrate();
            }
            context.EnsureSeedData();

            app.UseStaticFiles();

            app.UseAuthentication();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
Example #2
0
        static void Main(string[] args)
        {
            var context = new DSMSDBContext();

            if (!context.AllMigrationsApplied())
            {
                context.Database.Migrate();
            }
            context.EnsureSeedData();
        }