ASP.Net MVC 5 MEF, how to programmatically import and export parts?

I read all the many posts here on Stackoverflow about how to use MVC with MEF, and there are links to them, but I did not find the answer to all the questions, and on the Internet I was looking for how to create plugins with MEF that can include, shutdown, installation and removal from the administrator settings page.

I am trying to create my own CMS for MVC and would like to use MEF as part of my plugin infrastructure.

You just need to know how to programmatically install, uninstall, enable and disable plugins created for MEF.

After thinking of writing "plugins" for using MEF, then pack it in Nuget, where you can install and remove it from the administrator settings page.

Nuget will be responsible for installation and removal.

MEF will be responsible for registering the plugin, as well as some on and off options.

An example of a situation:

  1. User installs CMS

  2. The user goes to the admin section โ†’ Plugins

  3. The user sees a list of plugins that they can install and use for CMS

  4. The user clicks โ€œInstallโ€ and the MEF plugin is installed in the CMS

  5. User Click "Enable" and the MEF plugin is ready for use by the system

  6. The user wants to temporarily disable the plugin, the user clicks the "Shut Down" button

  7. The user no longer needs the plugin and clicks "Delete", and the plugin is completely removed from the CMS.

  8. The user understands that he accidentally deleted the wrong plug-in, the user clicks โ€œInstallโ€ again.

The goal is to be able to manage the plugins on the settings page of the administrator type, since the ability to install, remove, enable and disable would be a great feature in the CMS.

I know that other CMS use this type of function for their plugins, but I do not know a single one that uses MEF as part of its platform for this.

Most use their own internal plugins for these functions.

I hope I can use the MEF framework to help do this.

Another goal is to basically have a system where plugins designed for MEF and packaged in Nuget can be hosted somewhere like Nuget.org.

In the Nuget package, along with MEF, everything a plugin needs is in the Nuget package.

But since it uses MEF, this package can technically only contain 1 DLL, and when the user installs the Nuget Package, MEF will register the DLL on its website.

An example is a blog that comes with everything you need.

The user goes into the Visual Studio Install Nuget Package "Blog" and installs 1 DLL, which contains everything that he needs.

MEF will register the package on the user's website and thatโ€™s it.

No settings or anything on the user side.

Just pull and install from Nuget and that's it :)

+1
plugins asp.net-mvc content-management-system mef
Jul 26 '14 at 13:40
source share

No one has answered this question yet.

See similar questions:

74
MEF with MVC 4 or 5 - Pluggable Architecture (2014)
0
C # How to embed a connection string in a class?

or similar:

799
Download ASP.NET MVC 3.0 File
611
How do you handle multiple submit buttons in the ASP.NET MVC Framework?
559
ASP.NET MVC - Setting Custom IIdentity or IPrincipal Values
537
How to create a dropdown from an enumeration in ASP.NET MVC?
481
Compile Views in ASP.NET MVC
472
How to make ASP.NET MVC string representation?
33
Implementing MEF with ASP.NET MVC?
5
How to read MEF metadata in a DLL plugin without copying the entire DLL into memory?
2
MVC MEF Application Load
0
ASP.Net MVC 5 plugins, how to programmatically import and export parts?



All Articles