从不同的数据库中的表关联 - 实体框架 [英] Associate tables from different databases - Entity Framework

查看:82
本文介绍了从不同的数据库中的表关联 - 实体框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道如何(如果可能的话)让使用实体框架,不同的数据库与表的关联。我有一个EDMX我的XYZ的数据库,另一个是我的ZYX我需要给他们使用EF关联。我知道如何解决这个问题用FKS,这不是我想要的,我希望能够在使用可视化编辑器,不要用手加入FK到我的数据库做的。

I need to know how to (if possible) make an association with a table from a different database using entity framework. I have one edmx for my "xyz" database and another for my "zyx" I need to associate them using EF. I know how to fix this using FKs, that's not what I want, I want to be able to do that using the visual editor, not adding by hand a FK to my DB.

下面就是我想要的东西之实践的例子:

Here's an pratical example of what I want:

表用户 - 数据库:ABC
表信息 - 数据库:XYZ

Table User - database: abc Table Message - database: xyz

我需要用户到消息关联,反之亦然。

I need to associate User to Message and vice-versa.

谁能帮我?

谢谢!

推荐答案

可以一起查询他们Linq-到对象,但不与L2S或L2E。

You can query them together with Linq-to-Objects, but not with L2S or L2E.

一个方面是围绕着1 DB-连接包裹着,你无法跟踪多个分贝的/更新的entites。

A context is wrapped around 1 Db-connection, you cannot track/update entites from multiple db's.

一个可能的解决方法是链接到数据库的从另外一个。 MS-SQL可以做到这一点。对EF它会出现1个数据库。

A possible workaround is to 'link' to one of the Db's from the other. MS-SQL can do this. To the EF it would appear 1 database.

这篇关于从不同的数据库中的表关联 - 实体框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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