Reputation: 109
I'm facing a strange problem, I'm trying to run a method that explicitly migrates my database to the latest version withing EF code first, how ever when I run the method, nothing happened, heres my method that intends to migrate the database:
public void migrate()
{
Database.SetInitializer(
new MigrateDatabaseToLatestVersion<Alumnosdb, Migrations.Configuration>()
);
}
when I get to this method by way of debugging and hover over at Database, the connection states is closed and nothing happened.
Here is a snapshot where the problem occurs: http://s8.postimg.org/r20k94ifp/errormigrate.png
Hopefully someone can point me on how to migrate my schema by way of code cause it seems the way that I'm trying to achieve this is not working, so any advice would be really appreciate it.
Upvotes: 0
Views: 736
Reputation: 2121
This just sets the initializer, not runs it. It will run when you actually use DbContext session.
Upvotes: 1