Designer.cs is deleted when an object is added to DBML

There were objects in my dbml source file that had a data connection with another / db server. Since my db is changed to another server, and I want to update my spproc, when I delete spproc and drag the new one, dbml.designer.cs is deleted. I am using VS 2008 SP1. I cannot restore all of my dbmls since they have many tables, sps, etc. Inserting use inside the dbml namespace does not fix my problem.

+3
source share
1 answer

I ran into this problem. Oddly enough, the solution is to move any using statements into namespace brackets.

For example, I had this (using the using statement on top, as you usually saw):

using System.Configuration;
namespace BuildDashboard.Data
{
    partial class DashboardDBDataContext
    {
        ...
    }
}

And I had to change it to this (using the using statement inside the namespace):

namespace BuildDashboard.Data
{
    using System.Configuration;

    partial class DashboardDBDataContext
    {
        ...
    }
}

As soon as I made this change, my designer file was no longer deleted.

+1
source

Source: https://habr.com/ru/post/1731168/


All Articles