简体   繁体   English

DataContext-LINQ to SQL

[英]DataContext - LINQ to SQL

I deleted a column from a my ms sql database but my web app is still recognizing it. 我从ms sql数据库中删除了一个列,但我的Web应用程序仍在识别它。 I believe I need to regenerate my datacontext since I'm using LINQ but I can't find a way to do so in Visual Studio 2012. 我相信自从使用LINQ以来,我需要重新生成数据上下文,但是在Visual Studio 2012中找不到这种方法。

Can anyone assist me? 谁能帮助我?

Thank you. 谢谢。

Try This : 尝试这个 :

Open datacontext model and right click on the entity (Table) and click update. 打开datacontext模型,右键单击实体(表),然后单击“更新”。

If it doesn't work then you need to regenerate the datacontext or need to delete the column manually from the model. 如果它不起作用,则需要重新生成数据上下文,或者需要从模型中手动删除列。

If you have a .dbml file in your project, then it will need to be edited to change the DataContext subclass responsible for allowing LINQ to SQL to communicate with your database. 如果项目中有一个.dbml文件,则需要对其进行编辑以更改负责允许LINQ to SQL与您的数据库进行通信的DataContext子类。 Open it in the editor to see a diagram of the tables in the DataContext . 在编辑器中将其打开,以查看DataContext中的表的图表。 Right-click the column that has been removed, then click "delete" - this will remove all reference to the column.The project will need to be rebuilt once this is done. 右键单击已删除的列,然后单击“删除”-这将删除对该列的所有引用。完成后,需要重新构建项目。

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

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