any plans to make CompositionElementExtensions public ?

Jul 29, 2010 at 11:28 AM

Hi, I'm writing a custom catalog with an overriden GetExports method.

The goal is to have a config file ( similar to Unity configuration file ) so that even if there are a bunch of exports for a specific contract, the user can configure the app to chose only one to be used. the others are here, available for any change if the user wants to change its settings, but they are not active.

Of course, on the import side, there would be an [Import] attribute (Only one can be used at the same time, so no point in using a ImportMany attribute here)

The GetExports would then, for any contract mentionned within the config file, keep only one export ( the name of the exported class to keep would of course be in the config file ) : <mapping contract=IMyContract mapsto=MyContractImplementationNumber5 />

My only problem is to get the name of the exported class from the GetExports method : there is an extension method called GetDislayName in the CompositionElementExtensions class, but even though the extension method is public, the class is internal.

Of course, I could add Metadata to my exported classes, but I wanted to keep it light and not add useless metadata which would just be an exact copy/paste of the exported class.

Reflection could be an option, but if this class is internal, it must be for a reason, and if it's not supported, it might not be here in the next version of the framework, so I'd like to avoid this.

so ? any plan on making this class public ?

any idea for a workaround ?