Hello Nik,
I don’t know if Compile was the exact word I should have used. But in TSQL there are various ways to return information about tables, views, etc… CodeSmith gathers this information from the SQL Provider located on your local machine (C:\Users\Administrator\Documents\CodeSmith\Samples\v4.1\Projects\SqlSchemaProvider this is my path, you will need to edit it to match yours.) The below code should give you an idea as to what the provider is doing.
For Example:
SELECT
[TABLE_NAME] as N'Table Name',
[COLUMN_NAME] as N'Column Name',
[DATA_TYPE] as N'Data Type'
FROM
[Information_Schema].[Columns]
WHERE [TABLE_NAME] IN
(SELECT
[TABLE_NAME]
FROM
[Information_Schema].[Tables]
WHERE
[TABLE_TYPE] = N'Base Table')
ORDER BY
[TABLE_NAME],
[COLUMN_NAME],
[DATA_TYPE]
Will return
Table Name Column Name Data Type
aspnet_Applications ApplicationId uniqueidentifier
aspnet_Applications ApplicationName nvarchar
aspnet_Applications Description nvarchar
aspnet_Applications LoweredApplicationName nvarchar
You can get all the information about your databases with a few queries. CodeSmith has the SourceCommand and other Helper methods like GetParameterName that can get the name of a certain parameter in the parameter list, these use the provider.
You can take a look at how CodeSmith accomplishes this in the Command Wrapper template that I attached earlier in this thread. Just open the template and search for ('"Populate Parameters") It will give you a pretty good idea of how CodeSmith is able to retrieve information about a Stored Procedure.
Thanks
-Blake Niemyjski
Blake Niemyjski
CodeSmith Tools, LLC
Support Specialist
Blog: http://windowscoding.com/blogs/blake/
----------------------------------------------------------------------
Member of the .NetTiers team | Visit http://www.nettiers.com
----------------------------------------------------------------------