本文介绍了当我将表拖入 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!

耶!每次更新时不再删除额外的连接字符串!:D

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

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

07-26 05:28