在LINQ to SQL下管理不同开发人员的连接字符串 [英] Managing different developer's connection strings under LINQ to SQL

查看:51
本文介绍了在LINQ to SQL下管理不同开发人员的连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Subversion的源代码时,当两台不同的计算机具有不同的连接字符串时,我会遇到问题.

With my source in Subversion, I am having issues when 2 different computers have different connection strings.

LINQ to SQL设计器似乎只喜欢具有相同的连接字符串.

The LINQ to SQL designer seems to only like having the same connection string.

由于开发人员具有不同的本地配置,设计人员是否可以使用变化的连接字符串,但是Web应用程序中的实际用法来自web.config?

Is it possible for the designer to use a connection string that varies since developers have different local configurations, but the actual usage in the web application pulls from the web.config?

推荐答案

不幸的是,这是使用LINQ to SQL设计器的巨大痛苦.我不知道有一种方法可以强制Visual Studio在将表或存储过程拖到设计图面上时从不添加默认连接字符串.

Unfortunately, this is a huge source of pain with the LINQ to SQL designer. I do not know of a way to force visual studio to never add a default connection string when you drag tables or stored procedures onto the design surface.

我们因此解决了这个问题:

We work around the issue thusly:

  1. 我们从不保存开发人员密码
  2. 在更新DataContext时,我们绝不会在代码中使用默认的连接字符串
  3. 因此,我们可以在接触数据层的sprint期间安全地"忽略多个连接字符串
  4. 当情况消失/变得更加稳定时,我们可以使用设计器图面本身的属性或通过编辑XML从数据上下文中删除连接字符串.到那时,取决于数据上下文的修饰符来跟上删除默认连接字符串的步伐.

A,这不是理想的情况.希望VS2010将修复"此问题.

Alas, this is not an ideal situation. Hopefully VS2010 will "fix" this issue.

这篇关于在LINQ to SQL下管理不同开发人员的连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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