VS2013 数据库项目 - 您能否将数据库本身所做的*更改*导入到您的 VS 项目中?

2021-09-18 00:00:00 visual-studio sql-server

在 VS2013 中使用数据库项目,如果对底层物理数据库进行了更改(例如,使用 SSMS 添加表),如果您从 VS 进行架构比较,它会检测到这个新表,但是,从 VS看来您唯一的选择是忽略此更改,或者在执行 VS 架构比较中的更新时将其删除.

Working with a Database Project in VS2013, if changes are made to the underlying physical database (say, add a table using SSMS), if you do a schema compare from VS, it detects this new table, however, from the VS side it seems your only option is to either ignore this change, or delete it when you execute the Update in VS Schema Compare.

正确吗?

推荐答案

不正确,不是很直观,但是您可以将在物理数据库中所做的更改导入到您的 VS 项目中.诀窍是在模式比较屏幕中点击源实体和目标实体之间的切换方向"按钮,然后重新运行比较 - 然后,您将看到对该差异的操作已从删除更改为添加,并在执行时更新,该表将添加到您的 VS 数据库模型中.

Incorrect, it's not very intuitive, but you can import changes made in the physical database into your VS project. The trick is to hit the "switch direction" button between your source and target entities in the Schema Compare screen and rerun the Compare - then, you will see the action on that difference has changed from a Delete to an Add, and when you execute the Update, the table will be added to your VS database model.

在这篇博文中可以看到一些更详细的注释:

Some more detailed notes can be seen in this blog post:

http://sanderstechnology.com/2013/schema-modelling-with-visual-studio-2013-preview/12336/

相关文章