使用其他SQL用户将LINQ部署到SQL库 [英] Deploy a LINQ to SQL Library using different SQL users
问题描述
由于这个网站,我成功地使用了一个在web.config内本地化的connectionString,而不是该库的app.config中提供的connectionString。但是我的产品和测试的SQL Server没有相同的SQL用户名。
Thanks to this website I succeed to use a connectionString localized inside a web.config instead of the one provided in the app.config of the library. But my production and my test SQL Server do not have the same SQL user name.
Table(Name="SqlUserName.tableName")]
public partial class tableName : INotifyPropertyChanging, INotifyPropertyChanged
{
...
}
当我手动删除表名之前的用户名时,它就起作用了。但是我仍然有问题:
When I remove by hand the user name before the table name, it's working. But I still have to problems:
- 这样做好吗?也许存在我不知道的潜在缺陷。
- 如果这是一个好的行为,如何在某个地方进行配置?每次LINQ重新生成dbml时,我都会放松修改。我想我不能将其移到部分类中,因为它是一个属性并且无法重新定义(我也不想在所有表中都这样做)。
感谢您的帮助。
推荐答案
最后,我将dbo模式用于所有创建的表,通过这种方式消除了对用户的依赖,LINQ可以再次生成DBML而不会破坏部署:
Finally I used the dbo schema for all the tables I created, this way I removed the dependency on the user and LINQ could generate the DBML again without breaking the deployment:
Table(Name="dbo.tableName")]
public partial class tableName : INotifyPropertyChanging, INotifyPropertyChanged
{
...
}
这篇关于使用其他SQL用户将LINQ部署到SQL库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!