SubSonic、ORM、edmx、Linq:可序列化的 Db 通信?

发布于 2024-12-22 08:48:25 字数 660 浏览 1 评论 0原文

以下场景等待更好的替代方案:

  • 用 .NET 编写的中央 Windows 服务接受客户端在后台查询数据库(并且还允许它们写入数据库)。
  • 客户端应该能够使用旧式 .NET Remoting 来实现兼容性(或者可以非常简单地转换到 WCF),
  • 当前查询是通过自制对象发送的,这些对象要么携带标准指令(Insert、Update、SelectCommand),要么基于字符串直接 SQL 查询,但要使用 Linq,所有记录都需要拉到本地客户端,
  • 应该与 Oracle 和 MSSQL 配合使用。
  • 当表中的数据发生更改时,事件会从服务器发送到客户端 - 这是必须具备的!

这些是主要要求。现在我们已经开始评估使用 edmx 向 Linq 的过渡,但我们担心失去灵活性,并且我们将不得不重写所有 Db 处理代码。我们希望看到的基本改进是通过网络进行 Linqed 绑定,这样我们就可以使用 Linq 查询,而无需直接附加到 .NET 4 的 EMF 层。我开始研究 ORM 替代方案,现在遇到了 subsonic。

因此,开始问这个问题:) - 是否可以使用 SubSonic,使客户端拥有有关实体的所有知识,但查询转换和数据库连接仅托管在中央服务器上?由于数据库事件、复制和我们的应用程序所需的其他特定功能,我们希望解耦对数据库的直接访问。

问候弗洛里安

the following scenario waits for nice alternatives:

  • a central Windows service written in .NET accepts clients to query a database in the background (and also lets them write to the Db).
  • clients should be able to use old-style .NET Remoting for compatibility (or a very simple transition to WCF could be made)
  • currently queries are sent via homemade objects which either carry standard instructions (Insert, Update, SelectCommand) or a string-based direct SQL query, but to use Linq all records need to be pulled to the local client
  • should work with oracle and MSSQL
  • Events are sent to the clients from the server when data changes in a table - this is a must-have!

These are the main requirements. Now we have started to evaluate a transition to Linq with edmx, but we fear to loose flexibility and we would have to rewrite quite all of the Db handling code. The essential improvement we would like to see is a Linqed binding over the network so we can use Linq queries without directly attaching to the EMF layer of .NET 4. And I started investigation on ORM alternatives and came across subsonic right now.

So to start asking the question :) - will it be possible to use SubSonic in such a way that the client has all knowledge on the entities but the query transofrmation and the Db connection is hosted only on a central server? We want to decouple the direct access to the Db because of Db events, replication and other specific features necessary for our applications.

Regards Florian

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

美人迟暮 2024-12-29 08:48:25

有一个项目,InterLINQ,旨在以某种通用的方式解决类似于您所描述的需求(通用,因为能够在服务器端与多个查询提供程序一起工作)。我从来没有使用过这个项目,而且它似乎已经一年多没有工作了,而且缺乏文档。

我认为 SubSonic 不会比任何其他 linq 提供商更容易实现这一点。您可能会尝试以与提供者无关的方式序列化表示查询的表达式。

There was a project, InterLINQ, that was aiming to solve a need similar to what your describing in a somewhat generic way (generic, as in able to work with multiple query providers on the server side). I have never used this project, and it seems that it hasn't been worked on in over a year and it lacks documentation.

I don't think SubSonic would be any easier to achieve this with than any other linq provider. You would probably be just as well off trying to serialize the expression representing the query in a provider-agnostic way.

黎歌 2024-12-29 08:48:25

你的问题太宽泛了,我只能回答一小部分。

SubSonic ORM 3.0 包含一个 Linq to SQL 翻译器。您的 Linq 查询将转换为 SQL,并且仅将您实际使用的行返回给客户端。效果与编写自定义 SQL 非常相似,并且实际上您可以检索生成的 SQL。

您的大部分问题似乎超出了范围,因为它更多的是关于分布式查询处理而不是简单的 ORM 内容。

Your question is very broad -- I can only answer one tiny part.

SubSonic ORM 3.0 contains a Linq to SQL translater. Your Linq queries are converted into SQL, and only the rows you actually consume are returned to the client. The effect is much the same as if you had written custom SQL, and indeed you can retrieve the generated SQL.

Most of your question seems to be way out of scope, because it's more about distributed query processing rather than simple ORM stuff.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文