在添加DBML对象时删除了Designer.cs [英] Designer.cs is deleted on adding object in DBML
问题描述
我的原始dbml文件包含的对象具有与其他服务器/数据库的数据连接.由于我的数据库已更改为其他服务器,因此我想在删除spproc并拖动新的dbml.designer.cs时更新我的spproc.我正在使用VS 2008 SP1.我无法重新生成所有的dbml,因为它们具有很多表,sps等.在dbml命名空间中插入using并不能解决我的问题.
My original dbml file had objects which had data connection to other server/db. As my db is changed to different server and i want to update my spproc when i delete the spproc and drag the new one dbml.designer.cs is deleted. I am using VS 2008 SP1. I can't regenerate all my dbmls as they have lots of tables, sps etc.. Inserting the using inside the dbml namespace doesn't resolve my issue.
推荐答案
我只是遇到了同样的问题.奇怪的是,解决方案是将所有using语句移到名称空间括号中.
I just ran into this same problem. Bizarrely, the solution is to move any using statements into the namespace brackets.
例如,我有这个(顶部的using语句就像您通常看到的那样):
For example, I had this (with the using statement at the top like you would normally see):
using System.Configuration;
namespace BuildDashboard.Data
{
partial class DashboardDBDataContext
{
...
}
}
我不得不将其更改为此(使用命名空间中的using语句):
And I had to change it to this (With the using statement inside the namespace):
namespace BuildDashboard.Data
{
using System.Configuration;
partial class DashboardDBDataContext
{
...
}
}
进行此更改后,我的设计器文件将不再被删除.
Once I made this change, my designer file was no longer deleted.
这篇关于在添加DBML对象时删除了Designer.cs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!