在 AppDomain 之间共享类型

发布于 2024-10-04 14:13:39 字数 316 浏览 0 评论 0原文

我目前正在为我正在编写的程序开发一个加载项系统,并且遇到了主机和加载项应如何在公共基础上进行通信的问题。我使用 System.AddIn 命名空间(以前称为 MAF)来发现、隔离和激活加载项。

现在,由于我希望(需要?)加载项存在于与主机不同的 AppDomain 中,因此存在类型无法在 AppDomain 之间共享的问题,因此不能在主机和加载项之间共享。我知道 AppDomain 之间有一些内置的类型编组支持,但对此一无所知,也不知道它是否合适。

所以问题是,如果我想在两个单独的应用程序域中的加载项和主机之间共享相同的对象(实例),我该怎么办?也许有更微妙的方法来解决这个问题?

I am currently developing an add-in system for a program I am writing, and have run into the issue of how the host and add-in should communicate on a common base. I use the System.AddIn namespace (previously called the MAF) for discovery, isolation, and activation of add-ins.

Now, since I want (need?) add-ins to exist in separate AppDomains from the host, there exists the problem that types cannot be shared between AppDomains and thus not between host and add-in. I understand there is some built-in support for type marshalling between AppDomains, but know nothing about this, nor whether it is even appropriate.

So the question is, what can I do if I want to share the same object (instance) between add-in and host in two separate app-domains? Perhaps there is a more subtle way around this problem?

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

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

发布评论

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

评论(1

难忘№最初的完美 2024-10-11 14:13:39

所以看起来 MarshalByRefObject 和AppDomain 对象上的几个函数为我想要的提供了基础。我想案件暂时结束了。

So it seems MarshalByRefObject and a few functions on the AppDomain object provides the basis for exactly what I want. Case closed for now, I think.

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