简体   繁体   English

如何从.edmx文件中完全删除表的一列C#

[英]How to delete one column of table's from .edmx file fully c#

I am using Entity Framework version 4.0, I want to delete one column from the .edmx model. 我正在使用Entity Framework 4.0版,我想从.edmx模型中删除一列。 Because my development database contains one newly added column and my server database still doesn't have that column right now. 因为我的开发数据库包含一个新添加的列,而我的服务器数据库现在仍然没有该列。 So how can I solve this issue while publishing my code to my server? 那么在将代码发布到服务器时如何解决此问题?

You should always have a version of the published code and the database model that belong to that code. 您应该始终拥有已发布代码的版本以及属于该代码的数据库模型。 In the model, if you select the column in the table you can right click and choose "delete from model" which remove the column 在模型中,如果选择表中的列,则可以右键单击并选择“从模型中删除”,从而删除该列

The Entity data model can not be auto-updated so when making changes on the database you have to update the .edmx by : 实体数据模型无法自动更新,因此在数据库上进行更改时,您必须通过以下方法更新.edmx:
Right click on the diagram -> Update model from database -> select 'Add' then 'tables' finally on button 'Finish'. 右键单击图->从数据库更新模型->选择“添加”,然后选择“表”,最后单击“完成”按钮。
Tell us if it's resolved. 告诉我们是否解决。

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

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