Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# DataContext:相同的表结构,但不同部门的表名不同_C#_Sql_Datacontext - Fatal编程技术网

C# DataContext:相同的表结构,但不同部门的表名不同

C# DataContext:相同的表结构,但不同部门的表名不同,c#,sql,datacontext,C#,Sql,Datacontext,这篇文章与本文相似,但有所不同。 我的问题是: 在一个数据库中,我有两组不同的表,它们具有相同的结构,但名称不同。 例如: 表组1:MasterA-childA1-childA2-childA3 表集2:MasterB-childB1-childB2-childB3 A和B分别由我公司的不同部门使用。 我尝试使用C#DataContext,因为它非常容易使用(尽管不如旧时代的Delphi好)。但在编码之前,需要将DataContext硬连接到每个表。 在过去我们可以写作的地方 string SQ

这篇文章与本文相似,但有所不同。 我的问题是: 在一个数据库中,我有两组不同的表,它们具有相同的结构,但名称不同。 例如:

表组1:MasterA-childA1-childA2-childA3

表集2:MasterB-childB1-childB2-childB3

A和B分别由我公司的不同部门使用。 我尝试使用C#DataContext,因为它非常容易使用(尽管不如旧时代的Delphi好)。但在编码之前,需要将DataContext硬连接到每个表。 在过去我们可以写作的地方

string SQLStr = "....from Master" + departmentID + " where ...."
我正在尽可能地重用我的代码


谢谢

这是Linq2SQL还是实体框架?Linq to SQL。示例链接(如果我错了):可以将两组表加载到同一个dbml中吗?会很奇怪吗?