Reputation: 16080
I need to implement a very small plugin architecture.I am new to MEF so even simple things become complex. Lets assume I have 2 dlls Client(Executing Assembly) and Server Within Server I have a folder called "Plugins"
Usually I create a "Plugins" folder in the bin directory of the executingAssembly and all works with this piece of code,How Can I make it work if the plugin folder is in the Server?
private void LoadPlugins(string folder)
{
AggregateCatalog catalog=new AggregateCatalog();
catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly()));
catalog.Catalogs.Add(new DirectoryCatalog(folder));
CompositionContainer container =new CompositionContainer(catalog);
container.ComposeParts(this);
}
Any Suggestions?
PS The plugins will only be used to process logic within the server they are not used at all by the client
Upvotes: 4
Views: 5409
Reputation: 16744
Do you want to download the plugins from the server and use them in your client app? If so, you could download them to a specific path and create the catalog over that path. Or you could download each assembly, load it with Assembly.Load() or a similar method, and create an AssemblyCatalog over it.
Upvotes: 4