是否有可能查询多个数据库与WCF数据服务?多个、有可能、数据库、数据

2023-09-03 22:49:48 作者:总是看不惯你

我的数据插入到同一模式的多个数据库。在多个数据库性能方面的原因存在。

I have data being inserted into multiple databases with the same schema. The multiple databases exist for performance reasons.

我需要创建一个客户端可以用它来查询数据库的WCF服务。然而,从客户端查看的点,只有1个数据库。我的意思是,当一个客户端执行查询,应该查询所有数据库,并返回组合的结果。

I need to create a WCF service that a client can use to query the databases. However from the client's point of view, there is only 1 database. By this I mean when a client performs a query, it should query all databases and return the combined results.

我还需要提供灵活的客户端来定义自己的查询。因此,我期待到WCF数据服务,它提供了指定的客户端的查询非常好的功能。

I also need to provide the flexibility for the client to define its own queries. Therefore I am looking into WCF Data Services, which provides the very nice functionality for client specified queries.

迄今为止,似乎对DataService只能使查询到单个数据库。我发现没有覆盖,让我派遣查询到多个数据库。

So far, it seems that a DataService can only make a query to a single database. I found no override that would allow me to dispatch queries to multiple databases.

有谁知道这是可能的WCF数据服务查询对多个数据库具有相同的架构?

Does anyone know if it is possible for a WCF Data Service to query against multiple databases with the same schema?

推荐答案

我张贴的问题在MSDN论坛并发现它需要很多的努力。

I posted the question on the MSDN forums and found out that it will require a lot of effort.

它涉及创建自己的数据服务提供商,这是棘手的,可以是一个大量的工作。最重要的是合并的结果与排序+分页将是一个任务,那就是过于复杂和危险的东西,我愿意做顶。例如,我怎么查询1000页排序名称列多个数据库?我将基本上必须从所有数据库中查询所有数据,按名称排序,然后选择第1000页。

It involves creating your own data service provider, which is tricky and can be a lot of work. On top of that merging results with sorting + paging will be a task that is far too complicated and risky for what I am willing to do. For example, how do I query multiple databases for page 1000 sorted by the Name column? I would essentially have to query all data from all databases, sort by Name, then select the 1000th page.