ListAssist.MvcApplication.Application_Start C# (CSharp) Method

Application_Start() protected method

protected Application_Start ( ) : void
return void
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

#if DEBUG 
            // Drop, recreate and reseed the database
            Database.SetInitializer(new DbInitializer());
            using (var db = new ListAssistContext())
            {
                db.Database.Initialize(true);
            }

            // Recreate a edmx diagram from the latest model
            using (var ctx = new ListAssistContext())
            {
                using (var writer = new XmlTextWriter(HttpRuntime.AppDomainAppPath.TrimEnd('\\') + @".Data\EntityModelDiagram.edmx", Encoding.Default))
                {
                    EdmxWriter.WriteEdmx(ctx, writer);
                }
            }
#endif 
        }