简体   繁体   English

ADO.NET实体框架-LINQ到多个dbms

[英]ADO.NET Entity Framework - LINQ to multiple dbms

Is it possible to create an 'Entity' that will be an abstraction of a relationship between tables that live in two different tables, in two different databases, on two different machines, and even possibly using two different dbms? 是否可以创建一个“实体”来抽象化两个表之间的关系,该表位于两个不同表中,两个不同数据库中,两个不同机器上,甚至可能使用两个不同的dbms?

For example, if I have a SQL Server db on one machine that stores all my customers, and I have an Oracle db on a different machine that stores all my orders, is it possible to wrap this in an entity and then use the entity in a LINQ expression as if they were together? 例如,如果我在一台存储我所有客户的计算机上有一个SQL Server数据库,而我在另一台存储我所有订单的计算机上有一个Oracle数据库,则可以将其包装在一个实体中,然后在好像他们在一起的LINQ表达式?

Thanks! 谢谢!

Wow, that would be the ultimate n-Tier solution! 哇,那将是最终的n层解决方案!

Not as far as I know. 据我所知。 Unless you create a view and bind EF to the view, but then it would be read-only (obviously)? 除非您创建视图并将EF绑定到该视图,否则它将是只读的(显然)?

You can use multiple dbml files with different namespace for each file (like Myproject.Data.Customer,Myproject.Data.Orders etc..). 您可以为每个文件使用具有不同名称空间的多个dbml文件(例如Myproject.Data.Customer,Myproject.Data.Orders等。)。

I think is this manner you can use multiple databases residing on different machines. 我认为通过这种方式可以使用驻留在不同计算机上的多个数据库。 using different namespaces for different dbs provide very good isolation, it will helps you to keep each db layer separate and you can have separate person/team working on each layer independently. 对不同的数据库使用不同的命名空间可提供很好的隔离,这将有助于您将每个数据库层保持独立,并且可以让独立的人员/团队分别在每个层上工作。

You can put all these in single layers/namespace, but that will be make things more complicated and difficult to maintain. 您可以将所有这些放置在单个层/命名空间中,但这会使事情变得更加复杂且难以维护。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM