1

我有一个连接到 SQL Server 数据库的实体框架模型。我想从模型中删除一个表,而不是从数据库中。所以我在模型中的表上按删除并得到一个对话框:

Delete Unmapped Tables and Views

The following tables and views in the store model will no longer be mapped. Do you want them deleted?

Yes No Cancel

根据msdn

Yes: In addition to the objects in the conceptual model that you selected for deletion, all unmapped objects (shown in the dialog box display) are deleted from the storage model. This includes objects in the storage model that were already unmapped, not just objects that have become unmapped as a result of the deleting the selected conceptual model objects.

No: No objects will be deleted from the storage model. Only the objects in the conceptual model that you selected will be deleted.

Cancel: The operation is canceled. No objects in the conceptual model or storage model will be deleted.

因此,如果我正确理解这一点,是和否都会从模型中删除表,而取消不会?

是否也不是一个安全按钮,因为它不会从数据库中删除表或删除其数据?

我正在运行 Visual Studio 2012、C#、.NET 4.5 和 SQL Server 2012

4

2 回答 2

1

以下是它们的真正含义:

是 - 从设计器和 sql 数据库中删除。

否 - 从设计器中删除

取消 - 不删除任何内容

于 2013-03-08T13:47:58.883 回答
0

接受的答案是正确的一半。Yes 不会删除底层的 sql 表。

在此处输入图像描述

  • 否 - 从图表中删除,但不从 .Store 存储模型中删除:

在此处输入图像描述

  • 是 - 从图表和 .Store 存储模型中删除。不是实际的 Db 表。
  • 我在对表结构进行重大更改时经常这样做,即更改列名等。选择是,然后从数据库更新模型,然后重新添加表。
于 2020-08-26T16:08:44.773 回答