MVC Seed Method does not populate new database table RRS feed

  • Question

  • User-275352813 posted


    I ran the following:

    Add-Migration AddReasonType

    The new table was created with no issue. However, when I ran the Update-Database command it sat there with the message "Running Seed Method". I left it for an hour. When I came back the message was still displaying. I checked the table and there was no data in it. I closed down VS, opened it up, ran Enable-Migrations and Update-Database again. Once again, it sat there with the message "Running Seed Method". My code is as follows:

     public Configuration()
                AutomaticMigrationsEnabled = false;
                MigrationsDirectory = @"BabDbMigrations";
            protected override void Seed(BabDbContext context)
     private void SeedReasonType(BabDbContext context)
                var reasonType = new Entities.ReasonType[]{
                    new Entities.ReasonType{ Id = 1, Name = "Reason 1" },
                    new Entities.ReasonType{ Id = 2, Name = "Reason 2" },
                    new Entities.ReasonType{ Id = 3, Name = "Reason 3" },
                    new Entities.ReasonType{ Id = 4, Name = "Reason 4" },

    Any ideas?

    Monday, February 29, 2016 7:50 PM