跨多个数据库的实体框架 - SQL Server 和 SQL Server数据库2
谁能给我一点指导,让我朝着正确的方向前进。
我目前正在尝试使用 asp.net mvc3 编写一个 Web 界面,它提供了两个系统的单一视图,其中后端数据库为 MSSQL 和 DB2。
作为实体框架的新手,我尝试单独连接到每个数据库,并且可以成功拉回数据。
下一个合乎逻辑的步骤是尝试将数据库连接在一起以获得对数据的一些影响力。这是我遇到的一个绊脚石。
查看实体框架,当数据库位于不同的物理服务器上时,它似乎无法促进跨数据库连接。我在这里错过了一些明显的事情吗?我似乎找不到任何参考资料?
作为后备选项,我考虑使用链接服务器并将 sql 包装在视图中,理论上这将允许我运行我需要的查询类型。有人这样做过吗?
Can anyone give me a bit of a steer in the right direction.
I'm currently trying to write a web interface using asp.net mvc3 which provides a singular view of two systems with backend databases in MSSQL and DB2.
Being new to the entity framework I've attempted to connect to each of the databases in isolation and can pull data back succesfully.
The next logical step is to attempt to join the databases together to gain some leverage over the data. This is where I've hit a bit of a stumbling block.
Looking at Entity Framework it doesn't appear to facilitate cross database joins when the databases are sat on different physical servers. Have I missed something obvious here? I can't seem to find any reference to this?
As a fall back option I thought about using linked servers and wrapping the sql in a view which would theoretically allow me to run the types of queries I need. Has anyone done this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这种方法我已经做过很多次了。我只需要另一个数据库中的一两个表,因此创建视图很容易。
I have done this approach many times. I have only needed one or two tables from the other database, so creating the views is easy.