Adding New Plug-Ins On Run-Time

Dec 1, 2008 at 8:50 PM

Hello;

I am developing a project with MEF 3.0.
I can add the plug-in files with DirectoryPartCatalog method to my project.
When I add a new plug-in file, I can call the container_ExportsChanged with ExportsChanged event.
In this case I have some questions:

During the run-time when I add a new file I can not get information about the new plug-in file in the ExportCollection.
How can I get information of the new added plug-in file on run-time?

Can I load or unload a plug-in file on run time and how can I make this?

Thanks a lot for your answer.

Dec 1, 2008 at 8:59 PM

Hi

When you instantiate the DirectoryPartCatalog make sure to set the Boolean for watching files to true. Once you do that, the catalog will monitor any changes and notify the container upstream as new parts appear.\


In order to have your components participate in recomposition, you need to set the Boolean parameter on your [Import] attribute to allow recomposition. Once you do, those  properties will automatically get updated whenever a recomposition occurs.

Parts can also be notified when recomposition occurs, in order to do this, your parts should implement the INotifyImport interface.

As far as replacing assemblies once they have been loaded, the only way to do this is to set your app domain to shadow copy. If you do, then you can replace existing assemblies though the existing versions cannot be unloaded from memory, the new version will be loaded on top. You can add new assemblies though without using shadow copying.

Hope this helps

Glenn

From: muhendis [mailto:notifications@codeplex.com]
Sent: Monday, December 01, 2008 12:51 PM
To: Glenn Block
Subject: Adding New Plug-Ins On-RunTime [MEF:41220]

From: muhendis

Hello;

I am developing a project with MEF 3.0.
I can add the plug-in files with DirectoryPartCatalog method to my project.
When I add a new plug-in file, I can call the container_ExportsChanged with ExportsChanged event.
In this case I have some questions:

During the run-time when I add a new file I can not get information about the new plug-in file in the ExportCollection.
How can I get information of the new added plug-in file on run-time?

Can I load or unload a plug-in file on run time and how can I make this?

Thanks a lot for your answer.

Read the full discussion online.

To add a post to this discussion, reply to this email (MEF@discussions.codeplex.com)

To start a new discussion for this project, email MEF@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com