Return to Snippet

Revision: 58906
at August 9, 2012 04:40 by lookitstony


Initial Code
<#@ template  debug="true" hostSpecific="true" #>
<#@ output extension=".cs" #>
<#@ Assembly Name="System.Core.dll" #>
<#@ Assembly Name="System.Windows.Forms.dll" #>
<#@ import namespace="System" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Diagnostics" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Collections" #>
<#@ import namespace="System.Collections.Generic" #> 
<#@ assembly name="System.Xml.dll" #>
<#@ assembly name="System.Data.dll" #>
<#@ import namespace="System.Data" #>
<#@ import namespace="System.Data.SqlClient" #>
<#@ include file="SchemaCollector.ttinclude" #>
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Reflection;

namespace YOURNAMESPACE
{	<#  
		DatabaseInfo dbInfo = DataCollector.SchemaCollector("SERVER","DATABASE");
		List<TableInfo> tables = dbInfo.Tables; 
	#>

	//#########################################################################################################
	//   This file has been generated from the tables contained in the <#= dbInfo.Name #> database.
	//   Changes to this file will be overwritten when the file is regenerated.
	//#########################################################################################################

	<#
	// GENERATE TABLE TYPES
    foreach (TableInfo table in tables)
    {
	#>

    public class <#= table.Name #> : IConfigTable
    {
		<#
		PushIndent("        "); 
			foreach (ColumnInfo col in table.Columns)
            {
                WriteLine("public " + col.Type + " " + col.Name+ " { get; set; }");
            }
		PopIndent();
		#>		
    }
	<# } #>

}

Initial URL

                                

Initial Description
Requires: SchemaCollector.ttinclude that I created.

Initial Title
Model Generator

Initial Tags

                                

Initial Language
C#