将独立的 dll 加载到现有的 Appdomain 中并自动执行事件

发布于 2024-08-31 01:33:46 字数 267 浏览 1 评论 0原文

我有一个正在运行三个项目的解决方案。我的项目之一是与其他两个类隔离的类库。现在我想做的是将其加载到现有的应用程序域中,并在同一域中的其他程序集发生的某些事件上自动执行其方法。

我里面有一个事件,我想执行该事件

可以吗?我没有找到自动执行的方法。在谷歌搜索时,我发现 AppDomain.CreateInstance () 但无法充分利用它。

OR

捕获 APPDOMAIN 中发生的事件的方法。由于我已将 dll 加载到域中,因此如何捕获域内发生的事件。

I have a solutions where three projects are running. One of my project is class library that is isolated from other two class. Now what I want to do is to load it into existing appdomain and auto execute its methods on some event occured from other assemblies in same domain.

I have an event inside that, and i want to execute that event

Is it possible? I not getting the way to autoexecute an. While googling I fouund AppDomain.CreateInstance () but not able to fully utilise it.

OR

Way to trap events occuring in APPDOMAIN. Since i have my dll loaded in domain so how can I trap events occuring inside a domain.

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

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

发布评论

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

评论(1

携余温的黄昏 2024-09-07 01:33:46

这相当简单,这应该可以帮助您继续:
http://msdn.microsoft.com/en-us /library/ms173139(VS.80).aspx

基本上,您需要创建一个继承自 MarshalByRefObject 的对象,然后将其实例传递给父 Appdomain。现在,您的应用程序域中运行了一个对象,您可以对其进行操作,无论是附加或引发事件、调用方法等等。

It's reasonably straight forward, this should get you going:
http://msdn.microsoft.com/en-us/library/ms173139(VS.80).aspx

Basically you need to create an object that inherits from MarshalByRefObject, then pass an instance of it to the parent Appdomain. You now have an object running in your appdomain that you can manipulate, be it attaching or raising events, calling methods, whatever.

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