Brief Background:
My team has decided to use Microsoft's Managed Extensibility Framework (MEF) in order to provide an extensible model for adding new "providers" into our system.
This allows for us to plug in new 3rd party providers with relative ease.
Note: I was impressed by how simple MEF was to use and get up and running with.
My Question:
Since these providers commonly have different properties associated with them, when loading these providers into the system at run-time we need to access the providers data streams and properties.
What approach should be taken in order to work with said provider plug-ins due to the differing properties? Noting they all do a similar job.
My Solution:
Create an interface which the providers must conform to, resulting in a "wrapper" being created around each of the 3rd party providers resulting in a consistent interface / programming model for working with each provider.
Plug-in = 3rd party data source (provider) + Common interface implementation.
+ve: No need for a more complex reflection based dynamic "plug" for said plug-ins.
-ve: Have to write a wrapper for each provider. (We need to add the MEF Export tags regardless)
Further Note:
To me the interface / wrapper approach would be the simplest but I have been told to investigate a reflection based approach which may utilize reflection in order to discover the properties at run-time which can be exposed to the system.
I am not in favor of any one solution over another, but I would be interested in hearing the thoughts of the community (most of which are more experienced than I).
Thanks.