Superseding default parts

Feb 26, 2009 at 7:30 AM
Following suggersion is slighly related to this discussion: http://www.codeplex.com/MEF/Thread/View.aspx?ThreadId=35409
I think there should be some back door for developers superseding the default parts/contracts with external (let's say fixed/hotfixed parts).
Imagine a situation when the product is shipped and some default service i.e. IClipboardService or IUndoRedoService is malfunctioning. The best option could be providing a hotfix in the separate assembly that will replace the exiting [Export(typeof(IClipboardService))] or [Export("SomeInternalContract")] without recompilation and deployment of the whole product. 
It is quite obvious that there will be a set of default extensibility entry points reserved by the company itself, even non-ducumented I guess.
As for me it would be nice having a mechanism to supersede the existing single part with external one. Speaking about security... the could be a way explicitly defining whether a single part could be recomposed from the catalog or something like that...
Does it make sense?
Thanks in advance
Feb 27, 2009 at 1:59 AM
This makes perfect sense - in fact, an internal partner is doing exactly that. Today, you could achieve this by simply making use of the priorty-based ExportProvider hierarchy that exists today in the container. That is, the ExportProvider's that are passed to the container are consulted in priority order - simply create a new Catalog for every 'patch' assembly, wrap it in a CatalogExportProvider and make sure that its first in the list. The container will ask this guy first when attempting to locate a 'service' - if not found, it will move onto the rest of ExportProviders (and hence any underlying catalogs). 
Feb 27, 2009 at 6:23 AM
Yeah, I perfectly understand your suggestion and it seems the only way to accomplish my demands for the moment :)
However it seems to be some sort of a walkaround or even a dirty trick rather than some solution. I can end up with some versioning metadata not to relay on parts order I guess so that parts are selected by means of Version attribute/ExportMetadata.
Would be nice to have some Core support for simplifying developers' lifes but will agree that this is not a high priority for now.
Thanks for your support.