当我将表拖动到dbml文件中时,停止LINQ to SQL dbml更新连接字符串 [英] Stop LINQ to SQL dbml from updating connection string when I drag tables into the dbml file

查看:339
本文介绍了当我将表拖动到dbml文件中时,停止LINQ to SQL dbml更新连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次我将一个修改的表拖动到我的dbml,VS2010要我更新连接字符串,即使我已经创建了一个完全相同的信息的数据连接。每次发生这种情况,它将我的连接字符串更改为DataSourceConnectionString,我必须从5个不同的文件中删除它,并替换为我之前使用的连接字符串的名称,因此它不会使用该文件的所有其他人源控制。任何想法?

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?

推荐答案

我想出了另一个解决一些有些相关问题的答案。

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

为了解决这个问题,我需要删除我创建的数据连接连接到我的数据库从VS2010的服务器资源管理器窗口。然后,您需要打开.dbml设计器并右键单击空白处并选择属性。将打开一个属性窗口,将有一个连接部分,点击小箭头打开它。如果单击连接字符串行,将出现一个带有点(...)的按钮。当您单击此按钮将打开一个连接属性窗口。此窗口已经具有.dbml已有的所有相同的连接属性。所有你需要做的是单击确定,它会自动创建一个数据连接为你在服务器浏览器中,不会导致你添加一个新的连接字符串到.dbml当你拖动一个新的对象到它!

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!每次更新时不再删除额外的连接字符串! :D

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

这篇关于当我将表拖动到dbml文件中时,停止LINQ to SQL dbml更新连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆