If you've enabled the automatic migrations in Package Manager Console you can use the following code in an init section of your app (e.g. in SimpleMembershipInitializer):
var migratorConfig = new Migrations.Configuration();
var dbMigrator = new DbMigrator(migratorConfig);
dbMigrator.Update();
Where Migrations.Configuration is the migration configuration class placed in your project into your namespace (YourProjectNamespace.Migrations).
If you use it programmatically you should at first turn off the EF initializer:
Database.SetInitializer<YourDBContext>(null);
The thing is the programmatic update creates a database if it doesn't exist.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…