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

Accessing a parts metadata from within the part

Jan 28, 2009 at 6:02 AM

How can I go about easily getting access to a parts metadata from within the part itself?


[ExportMetadata("Name", "Test")]
public class Test : ITest
public void Print()
// How can I get the value of Name
Console.WriteLine("My Name is: " + ???)

Is there any way to do this other than using reflection?

Jan 28, 2009 at 6:18 AM
Edited Jan 28, 2009 at 6:18 AM
Hi Tc

By design we don't allow a part to access it's class level-metadata. The reason is because metadata is designed specifically to hold information that relates to whether or not the export should be created or not, and which will be used by importers rather than the export itself.


Jan 28, 2009 at 8:31 AM
I'd tend to avoid having classes that are self aware of stood off data like metadata.. you should have a third party to observe the relationship.