MEF vs Mono.AddIn

帅比萌擦擦* 提交于 2019-12-20 10:33:59

问题


I'm developing a .NET 3.5 C# desktop application. It should be extensible via plug-ins.

Are there any articles etc. discussing the differences between MEF and Mono.AddIn to help me make an informed decision?

Or even better have you got experience with both of these frameworks and can comment on them?

Thanks, Patrick


回答1:


[NOTE: I work on MonoDevelop, which uses Mono.Addins, but I discussed the differences between MEF and Mono.Addins extensively with Glenn Block from the MEF team last week]

MEF is based on composing code, though the underlying abstractions are very flexible. In contrast, Mono.Addins is based on a tree of metadata, where you can plug data/metadata/code into a rich schema of your definition, so extensions can add data/metadata as well as code.

Mono.Addins gives you an addin management/packaging/repository/update system out-of-the box. For MEF, at this point, you would have to build your own.

MEF has a slightly lower barrier to entry, and a lot more design work has gone into its usability and underlying abstractions. In addition, it's part of .NET 4, so it'll have a much bigger community of users developing with/for it.

At this point, if you need to plug in data/metadata as well as code and you want a ready-made packaging system, I'd recommend Mono.Addins, otherwise I'd recommend MEF. Going forwards, it's likely that Mono.Addins' features will be implemented on MEF, so there will probably be a migration path towards MEF.




回答2:


I believe Hanselminutes Show #181 has some discussion about Mono.AddIns and what it brings to the table.

While scouring the web I also found this discussion which highlights a difference in how these two frameworks currently handle catalog caching.




回答3:


I investigated both and decided to go with MEF, mostly because it's going to be released as part of .NET 4 so there will automatically be more support, discussion, and development surrounding it. Also, MEF seemed to be able to do everything I needed using attributes right in the code, and Mono.AddIns required some metadata files, if I remember correctly.

EDIT: If you'd like to see the result of my efforts at using MEF to build an extensible application framework, I've open sourced it, and given it a name: SoapBox Core.



来源:https://stackoverflow.com/questions/1592779/mef-vs-mono-addin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!