This project has moved. For the latest updates, please go here.

Rich Metadata

Sep 22, 2008 at 5:23 AM
Edited Sep 22, 2008 at 5:26 AM
Hi Guys,

Is it possible to add "rich" metadata via the metadata attributes?

For instance, I would like to expose a DrawingBrush (defined in xaml) as an "Icon" property on the metadata attribute of a class to export. The importing class could then use the brush to render content before the imported class is instantiated (via GetExportedObject()).

Is this scenario possible (and has anyone got any ideas how I could potentially implement this)?

Sep 22, 2008 at 5:57 PM
It is certainly possible. You can essentially store anything in the metadata that can be stored in an attribute (which are primitive types including string and System.Type). So there isn't anything stopping you from storing a XAML string and retrieving that yourself from the metadata and parsing it construct the icon.

However, you should be careful about embedding resources in the metadata, particularly ones that need to be localized.