为什么不在 Entity Framework 核心迁移中识别 -force?
Why not recognize -force in Entity Framework core migration?
我在 codefirst asp.net 核心项目的模型中删除了一个属性,并使用 update-databae -verbose
但没有从数据库的 table 中删除该属性。
然后我使用 update-database -verbose -force
命令,但收到一个错误,它无法识别 -force
。
Entity framework 核心 update-database
命令没有 -force
参数。它仅适用于 remove-migration
和 Scaffold-DbContext
命令。
您可以找到完整的命令列表 here。
您可以将 Scaffold-DbContext
命令与 -force
一起使用。 这样你可以强制脚手架覆盖现有的模型文件。使用这个命令时要小心。
Scaffold-DbContext "<ConnectionString>" Microsoft.EntityFrameworkCore.SqlServer -tables <tablename> -force
我在 codefirst asp.net 核心项目的模型中删除了一个属性,并使用 update-databae -verbose
但没有从数据库的 table 中删除该属性。
然后我使用 update-database -verbose -force
命令,但收到一个错误,它无法识别 -force
。
Entity framework 核心 update-database
命令没有 -force
参数。它仅适用于 remove-migration
和 Scaffold-DbContext
命令。
您可以找到完整的命令列表 here。
您可以将 Scaffold-DbContext
命令与 -force
一起使用。 这样你可以强制脚手架覆盖现有的模型文件。使用这个命令时要小心。
Scaffold-DbContext "<ConnectionString>" Microsoft.EntityFrameworkCore.SqlServer -tables <tablename> -force