Managed Extensibility

I am creating a service for my organization, which will be installed on hundreds of computers. The implementation of this may need to change over time. Having looked and read a little about MEF, I still lost a little. Is MEF a good mental ability to say if I want to dump the dll in the service folder and get this service, this service?

+4
source share
5 answers

I worked a little with MEF. Yes, MEF will do what you are looking for, with the caveat ...

  • You can detect and load a new DLL at runtime
  • However, it loads into the same application domain as your main application, so
  • You cannot unload or modify the DLL without restarting the application

If this last point is a problem, consider MAF (although it is much harder). But in MAF, it will upload your extensions to a separate application domain.

Another option is to simply start another process to process the request and pass command line parameters to it.

+3
source

If you are using VS2010, I recommend that you try to click "Once" first. It gives you the setup.exe file, but it also provides an HTML file (and other files) that you can upload to the IIS server or to an FTP site or even to a shared folder on your local network. The fact is that when you configure the deployment, you can tell the installer to automatically update all clients directly from the site (HTML file, ftp or lan public folder). When the user launches the application, he will connect to the site and request an update if it exists, and if this happens, the application will self-update. If you want to deploy the update, you will need to download the HTML file and all other files in the folder again.

Check out these links:

http://msdn.microsoft.com/en-us/library/ms953320.aspx

http://weblogs.asp.net/shahar/archive/2008/01/29/how-to-use-clickonce-to-deploy-your-applications.aspx

Happy coding;)

+1
source

I think you can do this if you have the service logic in a separate class library and you get the necessary contract interfaces in another class library. Then you can create a directory of catalogs and import your service implementation using MEF (you just need to reference the assembly of contract interfaces). Then you can choose a new dll / service implementation if it is changed. You only need the directory observer (FileSystemWatcher), then you need to call the directory update method when the observation manager starts. Theoretically, this should work, but this is just an idea. :) In any case, I hope this helps.

0
source

I am not an MEF specialist. The documentation says that Mef is building plugin-based systems. therefore, your system expects some interfaces, and MEF simplifies the import of classes implemented by these interfaces into your system. Your case is suitable for this. MEF has a directory of directories and with the help of directories you can import / dll runtime types.

How to get a MEF directory directory that looks at the same directory for both Servicelayer and DAL?

0
source

You can also watch Prism . From what I understand, they are two different structures that do almost the same thing. Prism allows you to create modules using a class in a dll that implements the IModule interface. You can simply drag and drop DLL files into a folder in the same way as in MEF. You can load modules statically or dynamically and do a bunch of other things that I don’t even know about.

Prism also has other functions associated with it, that is, a Unity dependency injection container (which I like to call the β€œMagic Black Box”), a neat system of events and commands, etc. I'm sure MEF has all of these things, too.

0
source

Source: https://habr.com/ru/post/1342351/


All Articles