Designer.cs is deleted on adding object in DBML

给你一囗甜甜゛ 提交于 2019-12-23 20:12:09

问题


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.


回答1:


I just ran into this same problem. Bizarrely, the solution is to move any using statements into the namespace brackets.

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
    {
        ...
    }
}

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.



来源:https://stackoverflow.com/questions/2190977/designer-cs-is-deleted-on-adding-object-in-dbml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!