I googled migration tutorials. In all af them, first run the application to create database by ef, then enable migration! Is there a way to create database with migration? not with runing the application? I try these:
Add-Migration CustomName // not works
Add-Migration $InitialDatabase // not works
Add-Migration InitialDatabase // not works
Add-Migration InitialCreate // not works
Update-Database // not works
Update-Database Update-Database –TargetMigration:$InitialDatabase // not works
If you have everything correctly setup (connection string, having run enable-migrations) then you should be able to run update-database
at the package manager console to get the database created.
The $InitialDatabase
is a special migration step that's automatically created. You should never try to add a new migration step with that name.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.