Template comments can be added using the <%- -%>tokens.
Use a script block to define an enumerated property.
Properly escape them using ASP.NET tags.
Constants must be declared inside <script runat="template"> tags.
<script runat="template"> private const string MY_CONST = "example"; </script> |
You can compile your templates in debug mode and set breakpoints in them.
Decorate the property with the FolderNameEditor attribute.
CodeSmith Generator includes a full API to let you make use of sub-templates.
Assemblies:
Namespaces:
Yes, use the CS_IsIdentity property.
Yes, use the CS_Default property.
<% foreach(ColumnSchema cs in SourceTable.Columns) { if (cs.ExtendedProperties["CS_Default"] != null) { Response.WriteLine(cs.ExtendedProperties["CS_Default"].Value); } } %> |
You can use the CommandSchema objects CommandText property or the ViewSchema objects ViewText property to view the source definition.
The CommandSchema object contains both input and output parameter collections which can be used to read these parameters.
You can use the ResponseEncoding attribute of the CodeTemplate directive to set the encoding for the template.