Template metadata implementation causes issues


Under the current implementation, the template metadata (Name, Description, Version) is exposed as properties of an instance of the template. The metadata is information about the definition/type of the template so being exposed via an instance is not as appropriate or flexible as it could be.
This is causing problems for when schema information is required in the constructor, such as setting a more dynamic output file path. When the studio adds a template assembly, it calls Activator.CreateInstance in order to get this metadata, but at that time, the schema information is not available.
To get around this, the metadata can be expressed using custom attributes that are defined against the template type rather than an instance of the template. This means that the studio will be able to query the custom attributes of the template type without having to instantiate an instance of the class.
While this is the best solution, another alternative would be to make those properties static because they are not values that need to be tied to an object instance.
Closed May 24, 2007 at 4:47 PM by kontac