是否可以在应用程序之间共享对象而无需序列化?

发布于 2024-10-05 13:42:59 字数 354 浏览 3 评论 0原文

是否可以在 C# 应用程序之间共享对象而无需序列化?

我需要三个应用程序共享同一对象的实例,但该对象本身不支持序列化。

范围是:我正在开发一些应用程序来创建 SVN 和 TFS 存储库之间的某种互操作性。但我不想在这三个应用程序上连接到 tfs 服务器(无用的耗时),因为其中一个只是一组小型实用程序,而且我不希望它加载缓慢。

因此,我正在考虑使用 RemotingServices.Marshal,在 tcp 通道中临时注册连接对象,并在其他应用程序中需要时调用该对象。

但事情是这样的。 TeamFoundation.Client 中的许多对象不可序列化,因此在尝试检索对象时出现错误。

我该如何解决这个问题?

Is it possible to share Objects between C# applications without serialization?

I need three apps to share an instance of the same object, but the object itself doesn't support serialization.

The scope is: I'm developing some apps to create some kind of interoperability between SVN and TFS repositories. But I don't want to connect to tfs server on the three apps (useless time consuming) since one of them is just a set of small utilities, and I don't want it to have a slow loading.

So I was thinking of using RemotingServices.Marshal, registering the connection object temporarily in a tcp channel, and calling the object whenever I need it in the other apps.

But here's the thing. Many objects in TeamFoundation.Client aren't serializable, so I get an error when trying to retrieve the object.

How can I solve this ?

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

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

发布评论

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

评论(1

花心好男孩 2024-10-12 13:42:59

序列化的直接替代方案是远程处理,但它也需要更改类型,因此行不通。

我不会尝试序列化 TFS 对象,而是编写一个类似于 TFS 对象(或者更好:您想要执行的请求等)的对象模型,然后发送该对象模型>。然后根据需要重建。本质上是实际对象之上的浅DTO层。

显然,您需要根据需要重建 TFS 模型(基于 DTO 状态),但这就是生活。

The direct alternative to serialization is remoting, but that also requires changes to the types, so isn't going to work.

Rather than trying to serialize the TFS objects, I would write a object model that resembles the TFS objects (or better: the requests etc that you want to perform), and send that. Then reconstruct as needed. Essentially a shallow DTO layer on top of the actual objects.

Obviously you'll need to reconstruct the TFS model as needed (based on the DTO state), but that is life.

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