views:

58

answers:

0

I am working on a project and have started to use IOC/DI (Unity) and I've looked into MEF. I have come across something which is related to IOC/DI and could probably reuse many of the components that IOC/DI containers use but which isn't the same.

This scenario is close to what MEF is trying to accomplish, but rather than assume that for any given dependency there is only a single matching provider, I want there to be multiple possible providers and I want to be able to configure the software using a configuration modul to choose which provider to object to use and to set various properties on the provider based on user entered values.

Example:

I have an Accounts Payable application which tracks invoices. I want to be able to associate images with each invoice. I want to define an IInvoiceImagingProvider (or some such) interface and have multiple implementations for this interface based on various 3rd party imaging storage providers.

In an application configuration utility program I'd like to have a MEF like container where I can insert my Invoice object and then dynamically discover all of the implementations of IInvoiceImagingProvider. Through a configuration UI I'd let the user choose the provider and configure various provider settings through a property page like UI. The code would then serialize this object graph.

In my Accounts Payable application when an Invoice object is created I'd then look up the serialized object graph and build up the imaging provider object and any dependent objects.

So, this is kind of like MEF in that it discovers plug in modules and allows building object graphs. The difference is that the user is given the choice of which of the matching plug in objects to use and they can then save this choice for later use.

Has anyone seen anything like this or does anyone have any suggestions on where I should start?