<#@ template language="C#" hostspecific="True" mergemode="LocalMerge" addtoheadofcollections="True"#> <#@ import namespace="Varigence.Languages.Biml.Task" #> <Biml xmlns="http://schemas.varigence.com/biml.xsd"> <Container> <Variables> <!-- Set the value of a variable by using the value from various tags on the TargetNode --> <Variable Name="SchemaName" DataType="String" ><#=TargetNode.GetTag("SchemaName")#></Variable> <Variable Name="TableName" DataType="String" ><#=TargetNode.GetTag("TableName")#></Variable> <Variable Name="ContainerName" DataType="String" ><#=TargetNode.Name#></Variable> </Variables> </Containers> </Biml>
This Transformer BimlScript snippet illustrates two features. The first is using the BimlScript <#= and #> tags, which mark the boundaries of an expression control block. This control block instructs the Biml compiler to execute the .NET code between the tags and insert the result directly in Biml. Thus, for the first variable, the Biml compiler will execute TargetNode.GetTag("SchemaName") and replace the BimlScript nugget with the value returned from GetTag(). In the third variable, the variable's value will be the TargetNode's name, again by using the expression control block.
The GetTag(string) method is a BimlScript addition that returns the text for an annotation whose tag matches the passed in string. Thus, for the second variable, GetTag("TableName") searches the TargetNode's annotations for the one whose tag is TableName. Once found, the method returns that annotation's text. This method is a shortcut for retrieving annotation text from a node.
Comments
There are no comments yet.