在.NET中创建插件环境的最佳方法

编程入门 行业动态 更新时间:2024-10-10 00:21:03
本文介绍了在.NET中创建插件环境的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我读过这篇论文如何在.NET中加载插件?,我真的没有看到微软的System.Addin命名空间的光彩。为什么我不能在我的bin目录中有一个plugins文件夹,用户可以将程序集放入实现我设计的接口?然后,我可以使用反射来创建插件类的实例并使用我的界面引用它。

I read this aricle How to load plugins in .NET?, and I really don't see the brilliance of Microsoft's System.Addin namespace. Why can't I just have a plugins folder in my bin directory that users can put an assembly into that implements an interface I design? I could then just use reflection to create an instance of the plugin class and reference it with my interface.

为什么System.Addin显然要好得多?特别是因为它似乎是工作的三倍和不太直观的设计。

Why is the System.Addin way apparently so much better? Especially since it seems like three times the work and a less intuitive design.

推荐答案

好多了总是取决于你的观点的观点和要求。如果您的方法符合您的需求,那就去吧。但是插件变得非常复杂得多。插件之间的依赖关系怎么样?安全?不同的schemata如何找到插件? ...?这些功能已经为您解决了。如果您不需要它们,那么库可能会过度。如果你需要它们,重新发明轮子是个坏主意。 ; - )

"so much better" always depends on your point of view and requirements. If your approach fits your needs, go for it. But plugins can become very fast much more complicated. What about dependencies between plugins? Security? Different schemata how to find plugins? ...? Those kind of features are already solved for you. If you don't need them, a library might be overkill. If you need them, it would be a bad idea to reinvent the wheel. ;-)

更多推荐

在.NET中创建插件环境的最佳方法

本文发布于:2023-11-28 06:35:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1641314.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:插件   环境   方法   NET

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!