Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            IDatabaseInitializer <BddContext> init = new InitChoixResto();

            Database.SetInitializer(init);
            init.InitializeDatabase(new BddContext());
        }
Esempio n. 3
0
        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());
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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());
        }