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 ;-)
by Paul Kohler
24. August 2009 19:15
Just a quick note on some recent changes.
The other day I checked in some “breaking changes” around the gathering of database schema information. I used to rely on the very bland combined DataTable information. I took the plunge and converted it to populate a tree of classes:
The columns contain some pretty rich data type information and have remained pretty generic.
There are primary key and non key collection filters etc. The main outstanding requirements that you simply cannot get out of the connection schema is foreign key relationships. This will need to be specific per connection which is a bit lame, some data sources will miss out simply due to the number of databases out there.
The other big change is that I am not trying to coerce all the schema gathering into the one area (my original hope) but now use a base schema collector with derivatives as required. Another advantage of this change is that I can actually provide schema information for databases that don not implement the “Get Schema” methods, for example, I have implemented an MS SQL Compact Edition (3.5) provider enabling Mini SQL Query to work nicely with SQLCE databases even though the provider throws a not implemented exception on a GetSchema call. I did this with a little help from Erik Ejlskov Jensen (http://erikej.blogspot.com). I am also looking at wrapping up his SQLCE Export tool as a plugin – see http://sqlcecmd.codeplex.com/.
Anyway, for now browse the code if you want to know more, I think its time for another release!