Exemple #1
0
        public int EnsureSeedData()
        {
            if (!AllMigrationsApplied())
            {
                throw new Exception("Migrations not applied.");
            }


            EntityTable.AddRange(Models.EntityTable.EnsureSeedData());
            Database.OpenConnection();
            Database.ExecuteSqlCommand("SET IDENTITY_INSERT dbo.EntityTable ON");
            var changeCount = SaveChanges();

            Database.CloseConnection();
            return(changeCount);
        }