protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); IDatabaseInitializer <BddContext> init = new InitChoixResto(); Database.SetInitializer(init); try { init.InitializeDatabase(new BddContext()); } catch (DbEntityValidationException e) { foreach (var eve in e.EntityValidationErrors) { Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage); } } throw; } }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); IDatabaseInitializer <BddContext> init = new InitChoixResto(); Database.SetInitializer(init); init.InitializeDatabase(new BddContext()); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); // Initialise la base de donnée à chaque démarrage IDatabaseInitializer<BddContext> init = new InitChoixResto(); // On hérite de InitChoixResto qui hérite de DropCreateAlwaysDatabse, car on a fait un override de la methode seed qui permet de remplir les données. Database.SetInitializer(init); init.InitializeDatabase(new BddContext()); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); // Rajout Bundle BundleConfig.RegisterBundles(BundleTable.Bundles); // Rajout pour initialiser la Base de données IDatabaseInitializer <BddContext> init = new InitChoixResto(); Database.SetInitializer(init); init.InitializeDatabase(new BddContext()); // Rajout Filtre FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); }
protected void Application_Start() { /*AreaRegistration.RegisterAllAreas(); * FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); * RouteConfig.RegisterRoutes(RouteTable.Routes); * BundleConfig.RegisterBundles(BundleTable.Bundles);*/ AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); IDatabaseInitializer <BddContext> init = new InitChoixResto(); Database.SetInitializer(init); init.InitializeDatabase(new BddContext()); }