NCodeGen
Documentation
Community
Related
You can write your templates in VTL (Velocity Template Language) or XSLT. Third party template languages like CodeSmith (ASP.NET like) can be used by implementing ITransfomationEngine interface
XML Manipulation NCodeGen unique feature : You can manipulate XML (input) very easy like late-bound languages. Compare it with using DOM. <Database> <Tables> <Table Name="ProcessDefinitions"/> </Tables> </Database> ----------------------------------------------------- #foreach ($Table in $Input.Database.Tables) $Table.Name #end Loops #foreach ($file in $project.GetSourceFiles()) <includes name="${file.RelativePath}"/> #end Conditional #if ($Remove == "true") public void Remove(string key) { items.Remove(key) ; } #end Macros #macro (FieldToParameter $field) [$field.Name] [$field.Type] ($!field.Size) #end #macro (ParametersDefinition $table) #set ($comma = "") #foreach ($field in $table.Fields) $comma $FieldToParameters($field) #set ($comma = ",") #end #end CREATE PROCEDURE [dbo].[$spName] ( #ParametersDefinition($Table) ) .... For more information about writing Velocity templates see Velocity User's Guide
NCodeGen unique feature : You can manipulate XML (input) very easy like late-bound languages. Compare it with using DOM. <Database> <Tables> <Table Name="ProcessDefinitions"/> </Tables> </Database> ----------------------------------------------------- #foreach ($Table in $Input.Database.Tables) $Table.Name #end
NCodeGen unique feature : You can manipulate XML (input) very easy like late-bound languages. Compare it with using DOM.
<Database> <Tables> <Table Name="ProcessDefinitions"/> </Tables> </Database> ----------------------------------------------------- #foreach ($Table in $Input.Database.Tables) $Table.Name #end
#foreach ($file in $project.GetSourceFiles()) <includes name="${file.RelativePath}"/> #end
#if ($Remove == "true") public void Remove(string key) { items.Remove(key) ; } #end
#macro (FieldToParameter $field) [$field.Name] [$field.Type] ($!field.Size) #end #macro (ParametersDefinition $table) #set ($comma = "") #foreach ($field in $table.Fields) $comma $FieldToParameters($field) #set ($comma = ",") #end #end CREATE PROCEDURE [dbo].[$spName] ( #ParametersDefinition($Table) ) .... For more information about writing Velocity templates see Velocity User's Guide
#macro (FieldToParameter $field) [$field.Name] [$field.Type] ($!field.Size) #end #macro (ParametersDefinition $table) #set ($comma = "") #foreach ($field in $table.Fields) $comma $FieldToParameters($field) #set ($comma = ",") #end #end CREATE PROCEDURE [dbo].[$spName] ( #ParametersDefinition($Table) ) ....
For more information about writing Velocity templates see Velocity User's Guide