Example #1
0
        protected void Seed(T context)
        {
            var initializer = InitializerFactory.GetEntityInitializerFor <T>();

            initializer.Seed(context);
            context.SaveChanges();
        }
Example #2
0
        public void InitializeDatabase(T context)
        {
            Database db = context.Database;

            if (!db.Exists() || !db.CompatibleWithModel(false))
            {
                db.Delete();
                db.Create();
            }
            DbInitializer dbinitializer = InitializerFactory.GetDbInitializerFor <T>();

            dbinitializer.InitializeDatabase(db);

            Seed(context);
        }
Example #3
0
        public void InitializeDatabase(T context)
        {
            Database db = context.Database;

            if (db.Exists())
            {
                db.Delete();
            }
            db.Create();

            DbInitializer dbinitializer = InitializerFactory.GetDbInitializerFor <T>();

            if (dbinitializer != null)
            {
                dbinitializer.InitializeDatabase(db);
            }

            Seed(context);
        }