问题描述
这是类似的问题,
当我将dev应用程序部署到prod服务器时,我遇到了一个错误:
When I deployed my dev app to the prod server I was getting an error:
系统.Data.SqlClient.SqlException:无效的对象名称'dbo.Login'。
System.Data.SqlClient.SqlException: Invalid object name 'dbo.Login'.
linq映射中的表属性看起来像[Table(Name = dbo .Login)]
The table attribute on the linq mapping looks like [Table(Name="dbo.Login")]
当我将prod db模式加载到vs2008服务器资源管理器中,并将其完全刷新了我的dbml时,prod上的应用程序,但现在开发应用程序不起作用。
When I loaded the prod db schema into the vs2008 server explorer and refreshed my dbml entirely with that one, the application on prod works, but now the application on dev does not work.
linq映射的表属性现在看起来像[Table(Name = prodDbUsername 。登录]]
The table attribute on the linq mapping now looks like [Table(Name="prodDbUsername.Login")]
在dev服务器上,我现在得到
On the dev server I now get
System.Data.SqlClient.SqlException:无效的对象名称'prodDbUsername.Login'。
System.Data.SqlClient.SqlException: Invalid object name 'prodDbUsername.Login'.
管理这些不同用户的最佳方式是什么?在dev和prod之间进行修改?
What is the best way to manage these different user prefixes between dev and prod?
推荐答案
听起来你在不同的环境中有相同的表命名。解决问题的最简单的方法是对所有环境使用相同的模式(数据可能不同,但是如果模式不同,则要求各种问题)。
It sounds like you have have identical tables named differently in your different environments. The simplest way to fix your problem is to use identical schema for all environments (the data can be different, but you are asking for all kinds of problems if the schema is not the same).
编辑:随着进一步的澄清,表将被创建,不同的所有者或不同的模式。请参阅,以进一步澄清差异。
With your further clarification, the tables are being created either with a different owner or a within a different schema. See http://www.sqlteam.com/article/understanding-the-difference-between-owners-and-schemas-in-sql-server for further clarification on the difference.
我建议您尝试使用以下语法创建表:
I would recommend that you try creating your tables with the following syntax:
CREATE TABLE [dbo].[MY_TABLE_NAME]...
这篇关于LINQ to SQL:在表属性上需要Prod和Dev DBML的不同用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!