Strongly typed metadata

Sep 10, 2010 at 2:27 PM

Is it possible to strongly type PartMetadata (for filtering) like you can with Export data?  If we can't, is it possible to add more than one key value pair to the PartMetadata?  I am having trouble finding any information on this.



Sep 11, 2010 at 1:15 AM
Edited Sep 11, 2010 at 1:18 AM

Just stacking metadata key/value pair declarations (i.e. corresponding attributes) one above the other works fine, and as expected, in my case.

All my values are strings so I cannot say much on strong metadata types, even if I see no reason why other value types would be any different from values of string type.

When I enumerate the exports inside the container I get a dictionary of keys and values for metadata on each export. The key is the string (as expected) while the value is object since it can be any type.

Look at ContractBasedImportDefinition constructor.

Its metadata parameter is IEnumerable of KeyValuePairs and expects a CLR Type for each value so that I would say

you definitely can filter on metadata value type(s).

Sep 11, 2010 at 2:41 AM

Yeah, I got that aspect of it working.  I figured out that you could stack the attributes.  I was more curious if you could build a custom attribute for the properties like you can with the Export metadata.  Thanks for the input.