Base solution for your next web application
Open Closed

The model backing the 'FeedbackDbContext' context has change #1709


User avatar
0
dsalodki created

I have runned

PM> Add-Migration Provider Scaffolding migration 'Provider'. The Designer Code for this migration file includes a snapshot of your current Code First model. This snapshot is used to calculate the changes to your model when you scaffold the next migration. If you make additional changes to your model that you want to include in this migration, then you can re-scaffold it by running 'Add-Migration Provider' again. PM> Update-Database Specify the '-Verbose' flag to view the SQL statements being applied to the target database. Applying explicit migrations: [201609191116025_Provider]. Applying explicit migration: 201609191116025_Provider. Running Seed method.

I do not understand why public partial class Provider : DbMigration { public override void Up() { }

    public override void Down()
    {
    }
}

empty


2 Answer(s)
  • User Avatar
    0
    dsalodki created

    I added

        public override void Up()
        {
            CreateTable(
                    "dbo.Providers",
                    c => new
                    {
                        Id = c.Long(nullable: false, identity: true),
                        ProviderName = c.String(nullable: false, maxLength: 128),
                        Guid = c.Guid(nullable: false)
                    })
                .PrimaryKey(t => t.Id);
        }
    
        public override void Down()
        {
            DropTable("dbo.Providers");
        }
    

    run in package manager console update-database db not updated. error still present.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    If you are getting an error "The model backing the 'FeedbackDbContext' context has change", then Add-Migration Provider command should not generate empty classes.

    Do you select "*.EntityFramework" project before running Add-Migration on the Package Manager Console ?