“删除未映射的表和视图”对话框的替代方法有哪些?

时间:2013-03-07 14:35:47

标签: sql-server entity-framework visual-studio-2012

我有一个连接到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

2 个答案:

答案 0 :(得分:1)

这是他们的真正含义:

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

否 - 从设计师

中删除

取消 - 不删除任何内容

答案 1 :(得分:0)

接受的答案是正确的一半。是的,不会删除基础SQL表。

enter image description here

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

enter image description here

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