Linq DBML多个SQL Server [英] Linq DBML multiple sql servers

查看:88
本文介绍了Linq DBML多个SQL Server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为简单起见,我有一个必须位于两个sql数据库上的存档系统

I have an archive system that had to be on two sql databases for simplicity

一个是
存档2009
和另一个Archive2010

它们都在同一台sql服务器和实例上,并且具有相同的结构 但是我有一个页面需要查看旧页面和新页面(我可以制作两个单独的页面)

one is
Archive2009
and the other Archive2010

they are both on the same sql server and instance and have identical structures however I have a page that needs to view the old one and the new one (I can make two seperate pages)

我将如何最好地做到这一点?动态更改连接字符串等?

How best would I go about doing this? Dynamically changing the connection string etc?

推荐答案

如果要通过L2S访问这些数据库,则可能需要一个指向Archive2009的DBML和一个指向Archive2010的DBML.然后,您的查询可以使用任何合适的DBML.如果遇到命名空间问题,请为每个DBML使用不同的生成的命名空间.

If you are accessing these databases via L2S, then you'll probably want a DBML that points to Archive2009, and a DBML that points to Archive2010. Then your queries can use whichever DBML is appropriate. If you run into namespace issues, use different generated namespaces for each DBML.

这篇关于Linq DBML多个SQL Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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