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
.
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