简体   繁体   中英

C# .NET Plugin Framework

I have been working on a Plugin based application in C#. Stumbled across Managed Extensibility Framework (MEF) but this seems to be obsolete and support is dropped off Prism and other Frameworks.

Are there any alternatives to MEF for .NET Framework? A lot of information around plugins is rather dated and old.

Thanks

MEF is NOT a Dependency Injection Container and for that reason it has been removed. So where to look?

  • The Unity Container (not to be confused with the Unity game development framework), has long been a very popular container for Prism developers, and is what Brian has used for years.
  • DryIoc has been a very popular and extremely fast alternative for the last several years and has converted many long term Unity fans because of it's performance and great API's.
  • Ninject is still supported for the moment for WPF. That said this could change in the future. The project is showing signs of being dead. They haven't had a release in over 2 years, it's not particularly fast, or widely used by Prism Developers.
  • BYOC (Bring your own container)... Prism 7 introduced a complete abstraction for Dependency Injection. This means that if there is a container that you would like to use, you can implement the IContainerExtension for the container you want and bring that into your project. NOTE for WPF development you would still need to tie that container into the ServiceLocator currently used by WPF. You can read more on that from this blog post on Using "Unsupported" DI Containers

Are there any alternatives to MEF for .NET Framework?

MEF is perfectly fine as plugin framework , no need to look somewhere else.

But you shouldn't also use it as dependency injection container (see Dan's answer).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM