by Paul Kohler
28. August 2009 18:19
This is pretty cool.
I changed the simple templating engine to use NVelocity (from the Castle project). Basically its pretty powerful:
ConnectionString: "${Model.ConnectionString}"
ProviderName: "${Model.ProviderName}"
#foreach ($table in ${Model.Tables})
$table.Name
#foreach ($c in $table.Columns)
* $c.Name
#end
#end
It’s a first cut but you can also supply parameters:
#@get TableName
IF OBJECT_ID('${TableName}', 'U') IS NOT NULL
DROP TABLE [${TableName}]
CREATE TABLE [${TableName}]
(
${TableName}Id INT IDENTITY NOT NULL,
CONSTRAINT PK_${TableName}Id PRIMARY KEY (${TableName}Id)
)
To try it out either get latest from the trunk (http://minisqlquery.codeplex.com/SourceControl/ListDownloadableCommits.aspx) or grab a build:
http://www.pksoftware.net/MiniSqlQuery/Download.aspx
I am going to add data functionality etc… There is not much doco on NVelocity but its pretty powerful… More to come – PK ;-)