Why not recognize -force in Entity Framework core migration?

asp.net-core c# database-migration ef-migrations entity-framework-core

Question

I deleted an attribute in model of codefirst asp.net core project, and use update-databae -verbose but did not delete the attribute from table of database. Then I used update-database -verbose -force command, but received an error that it did not recognize -force.

1
0
11/3/2019 6:33:30 PM

Accepted Answer

Entity framework core update-database command does not have -force parameter. It's only available for remove-migration and Scaffold-DbContext commands.

You can find a complete list of commands here.

You can use Scaffold-DbContext command with -force. This way you can force scaffolding to overwrite existing model files. Be cautious when using this command.

Scaffold-DbContext "<ConnectionString>" Microsoft.EntityFrameworkCore.SqlServer -tables <tablename> -force
0
11/3/2019 8:17:35 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow