Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop LINQ to SQL dbml from updating connection string when I drag tables into the dbml file

Every time I drag a modified table into my dbml, VS2010 wants me to update the connection string even though I have created a data connection with the exact same information. Every time this happens it changes my connection string to 'DataSourceConnectionString' and I have to delete it from 5 different files and replace it with the name of the connection string I was using previously so it doesn't screw up everyone else using the file through source control. Any Ideas?

like image 628
Chris - Haddox Technologies Avatar asked Jun 26 '12 18:06

Chris - Haddox Technologies


People also ask

What is Dbml in Linq to SQL?

The LINQ to SQL is the component of . NET Framework version 3.5. It provides the run time infrastructure to manage the relational data as objects. It allows us to access and get the data from the SQL database with LINQ queries.

How do I add a stored procedure to a Dbml file?

To add stored procedures to the O/R Designer dbml file that you added earlier. Click the Sales by Year stored procedure and drag it to the right pane of the designer. Click the Ten Most Expensive Products stored procedure drag it to the right pane of the designer. Save your changes and close the designer.

How do I open Dbml in designer mode?

After the installation was done go to the dbml file, right click and select View Design. That's it.


1 Answers

I figured out another away after tinkering with answers to some somewhat related issues.

To solve the problem I was having I needed to delete the Data Connection I created to connect to my database from your server explorer window in VS2010. You then need to open the .dbml designer and right-click in the white space and select properties. A properties window will open and there will be a "Connection" section, click on the small arrow to open it up. If you click on the connection string row a button will appear with dots(...) on it. When you click on this button it will open a Connection Properties window. This window will already have all of the same connection properties your .dbml already has. All you have to do is click 'OK' and it will automatically create a data connection for you in the server explorer that wont cause you to add a new connection string to the .dbml when you drag a new object to it!

Yay! No more deleting extra connection strings every time I update! :D

like image 96
Chris - Haddox Technologies Avatar answered Oct 05 '22 21:10

Chris - Haddox Technologies