简体   繁体   English

是否有执行与添加迁移相同的 function 的 EF Core Package 管理器控制台命令<name> EF6 中的 -IgnoreChanges 命令</name>

[英]Is there an EF Core Package Manager Console command that performs the same function as the Add-Migration <name> -IgnoreChanges command in EF6

I often target existing databases, I have all the tables mapped but the program thinks it is out of agreement with SQL Server.我经常针对现有数据库,我已映射所有表,但程序认为它与 SQL 服务器不一致。 In EF6 I would add a migration using ignore changes then call update-database and that always worked for me.在 EF6 中,我将使用忽略更改添加迁移,然后调用 update-database,这对我总是有效。 I like using this method as my understanding was the EF would not push any actual changes to the database (for example if the tables mapped weird, I had a situation where EF would completely whiff on the foreign key connections).我喜欢使用这种方法,因为我的理解是 EF 不会将任何实际更改推送到数据库(例如,如果表映射很奇怪,我遇到的情况是 EF 会完全影响外键连接)。

My question is there a similar ability in EF Core using the package manager console.我的问题是在使用 package 管理器控制台的 EF Core 中有类似的能力。

Alternatively, if the ignorechanges parameter has been deprecated, is there anyway to sync the C# models (ie some parameter within update-database maybe?) with the SQL Server database that guarantees no modifications from C# can be pushed to the production tables, but down stream changes can be received?或者,如果不推荐使用 ignorechanges 参数,是否可以将 C# 模型(即更新数据库中的某些参数可能?)与 SQL 服务器数据库同步,以保证不会从 ZD7EFA19FBE74D3972FDZ5ADB6 stream 更改可以接收吗?

You can manually edit the generated migration C# code and comment out the contents of the Up() method to get the same effect on EF Core.您可以手动编辑生成的迁移 C# 代码并注释掉Up()方法的内容,以在 EF Core 上获得相同的效果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM