I decided to package a few CodeSmith Templates I've written lately to give a little something back to those in the CodeSmith Community who have provided so much valuable information to me in the CodeSmith Template Share Forum and elsewhere. (I really do need to spend more time digging into the forum templates!) This homebrewed CodeSmith package is also [selfishly] intended to motivate me to keep thinking about Code Generation in my everyday work and as a result continue to add new templates to the package over time.
The ZIP is located at http://dbvt.com/x/a/dbvtCodeSmith1.0.zip. The DESCRIPTIONS.TXT file is shown below.
CodeSmith Templates
Dave Burke
Language: C#
CodeSmith Version: 3.0
http://dbvt.com/blog
Iteration: 1.0
This doc provides a brief description of utility templates. I hope to add to this package over time as I create more templates in my everyday work.
Last Updated: 7/12/2005
BUSINESSOBJECT.CST
Creates a simply, empty business object as used in dotText. No instance method.
Reads from existing SQL Table. Typically I do a "select * into TmpTable from SomeQueryOrView" and add a primary key manually.
DATROWVIEWCOPY.CST
Generates an ADO.NET 2.0 Add[DataTable]Row() method from a DataRowView object.
Reads from existing SQL Table as in BusinessObject.cst above.
Ex: _projects.AdddtProjectsRow(
drv["ProjectWorkingID"].ToString(),
drv["Description"].ToString(),
drv["CompanyName"].ToString(), ...)
Also creates an empty tablerow.
Ex: MyDataSet.dtProjectsDataTable _projects = new MyDataSet.dtProjectsDataTable();
_projects.AdddtProjectsRow(
"NA",
"No Projects Available for this view",
"",
DateTime.Parse("1/1/1910"),
true,
DateTime.Parse(DateTime.Now.ToShortDateString()),
"", ..."");
ENUMFROMTABLE.CST
Reads values from SQL Table to create a Enum. Used primarily for enums based on tables which change throughout development process.
Ex: public enum ViewType
{
User = 0,
MarketSegment = 1,
Company = 2
}
DBVTHELPER.CST
Codebehind class for templates.