2

Does Entity Framework Code First Migrations store its migration data anywhere else other than the target database and the Migrations folder?

I have an odd scenario where I've added a brand new .NET model class, and added it to my datacontext - but for some reason it's not being added to the generated DbMigration when I do an Add-Migrations. It's as if EF thinks it's already there. What confirms my suspicion that EF thinks it's already there is that if I comment out some of the properties in my new .NET class, the generated DbMigration then contains calls to DropColumn to remove those properties! I don't understand this though, as I've completely deleted the target database, and removed any migration files that have anything to do with that class. I don't understand how EF knows those properties were ever there.

I've tried explicitly specifying the connection string when running Update-Database and Add-Migration, to make sure that it's not connecting to another copy of the database somewhere. This doesn't make a different though.

Does EF cache the data somewhere? Is there some other place this information is stored?

1 Answer 1

1

I believe this is the answer; https://stackoverflow.com/a/25432088/1087768

Basically what I did to make it to work again was to remove both database and migration files and re-create the migration files with Add-Migration. Then Update-Database should work as expected.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.