Wednesday, May 30, 2012

Adding Parameter Schemas in the .NET TBB Code

For those of you who don't know, a parameter schema is a special type of schema which allow developers to pass parameters to the Template Building Blocks (TBBs). The main purpose (if not the only) of this type of schemas is to make TBBs more flexible so that these can be reused across multiple environments and implementations.


Sometimes after setting the parameter schema in the TBB, somehow it seems to disappear after uploading a newer version of the assembly or after using Content Porter to import the TBBs. 


The parameter schema can be set programatically inside the TBB itself, the way to do this is simply by adding an attribute to the class as follows: 

[TcmTemplateTitle("Add page properties")]    [TcmTemplateParameterSchema("/webdav/02D%20_Design%20Parent/Building%20Blocks/System/Schemas/Parameters%20Schemas/Publish%20files%20Parameter%20Schema.xsd")]

    public class AddPageProperties : ITemplate
        public void Transform(Engine engine, Package package)
            // The place for the wizard to do the magic :)

The only thing you need to add is the attribute TcmTemplateParameterSchema to the class.


  1. You can actually embed the Schema within your Building Block project. Mark the schema as an Embedded Resource, and reference the schema as follows:

    [TcmTemplateParameterSchema("resource:[Default Namespace].[Folder names separated by "."].[Schema Name].xsd")]

  2. I bought a pair of gucci bags for my boyfriend at this online store. replica gucci handbags The quality is very good, the style of the bag is very like, it is very worth buying, there are many famous designer brand replica gucci,replica luxury gucci monogramming we are sure that it has high quality and appearance.