Skip to content

Commit

Permalink
Auto-generating the main T4 template file (chinook.t4) from the Chino…
Browse files Browse the repository at this point in the history
…okMetadata assembly and refactoring existing T4 templates to include Chinook.t4.

--HG--
extra : convert_revision : svn%3A620c4292-3293-3848-9960-d3592df64433/Trunk%4019
  • Loading branch information
lerocha committed Apr 28, 2009
1 parent 3604585 commit e1b2ae3
Show file tree
Hide file tree
Showing 23 changed files with 12,584 additions and 230 deletions.
12 changes: 6 additions & 6 deletions Source/ChinookDatabase.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChinookDatabase", "ChinookD
{67E64402-FB7A-4D55-9E8E-B0818B693639} = {67E64402-FB7A-4D55-9E8E-B0818B693639}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChinookMetadata", "ChinookMetadata\ChinookMetadata.csproj", "{67E64402-FB7A-4D55-9E8E-B0818B693639}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChinookMetadata.Test", "ChinookMetadata.Test\ChinookMetadata.Test.csproj", "{FE4EC648-40D4-41DD-8C3B-8BC76D3275EB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChinookMetadata", "ChinookMetadata\ChinookMetadata.csproj", "{67E64402-FB7A-4D55-9E8E-B0818B693639}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -20,14 +20,14 @@ Global
{AC2D0974-9B63-429A-BB62-031B716C8861}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AC2D0974-9B63-429A-BB62-031B716C8861}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AC2D0974-9B63-429A-BB62-031B716C8861}.Release|Any CPU.Build.0 = Release|Any CPU
{67E64402-FB7A-4D55-9E8E-B0818B693639}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{67E64402-FB7A-4D55-9E8E-B0818B693639}.Debug|Any CPU.Build.0 = Debug|Any CPU
{67E64402-FB7A-4D55-9E8E-B0818B693639}.Release|Any CPU.ActiveCfg = Release|Any CPU
{67E64402-FB7A-4D55-9E8E-B0818B693639}.Release|Any CPU.Build.0 = Release|Any CPU
{FE4EC648-40D4-41DD-8C3B-8BC76D3275EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FE4EC648-40D4-41DD-8C3B-8BC76D3275EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FE4EC648-40D4-41DD-8C3B-8BC76D3275EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FE4EC648-40D4-41DD-8C3B-8BC76D3275EB}.Release|Any CPU.Build.0 = Release|Any CPU
{67E64402-FB7A-4D55-9E8E-B0818B693639}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{67E64402-FB7A-4D55-9E8E-B0818B693639}.Debug|Any CPU.Build.0 = Debug|Any CPU
{67E64402-FB7A-4D55-9E8E-B0818B693639}.Release|Any CPU.ActiveCfg = Release|Any CPU
{67E64402-FB7A-4D55-9E8E-B0818B693639}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
20 changes: 8 additions & 12 deletions Source/ChinookDatabase/ChinookDatabase.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ChinookMetadata, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Lib\ChinookMetadata.dll</HintPath>
</Reference>
<Reference Include="MySql.Data, Version=5.1.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Lib\MySql.Data.dll</HintPath>
Expand All @@ -75,11 +71,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="T4Templates\DataSetHelper.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>DataSetHelper.tt</DependentUpon>
</Compile>
<Compile Include="Tests\ChinookMySqlFixture.cs">
<SubType>Code</SubType>
<DesignTime>True</DesignTime>
Expand All @@ -101,7 +92,6 @@
<DesignTime>True</DesignTime>
<DependentUpon>DatabaseFixture.tt</DependentUpon>
</Compile>
<Compile Include="Tests\T4TemplatesFixture.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
Expand Down Expand Up @@ -171,10 +161,16 @@
<DependentUpon>CreateDB.tt</DependentUpon>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="T4Templates\DataSetHelper.tt">
<None Include="Scripts\SqlServer\CreateDB_NoIdentity.sql">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>CreateDB_NoIdentity.tt</DependentUpon>
</None>
<None Include="Scripts\SqlServer\CreateDB_NoIdentity.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>DataSetHelper.cs</LastGenOutput>
<LastGenOutput>CreateDB_NoIdentity.sql</LastGenOutput>
</None>
<None Include="T4Templates\Chinook.t4" />
<None Include="Tests\DatabaseFixture.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>DatabaseFixture.cs</LastGenOutput>
Expand Down
Binary file modified Source/ChinookDatabase/SampleData/ChinookData.tt
Binary file not shown.
15 changes: 5 additions & 10 deletions Source/ChinookDatabase/Scripts/MySql/CreateDB.tt
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
<#@ template language="C#" hostspecific="true"#>
<#@ template language="C#v3.5" hostspecific="True"#>
<#@ output extension="sql" #>
<#@ assembly name="System.dll" #>
<#@ assembly name="System.Xml.dll" #>
<#@ assembly name="System.Data.dll" #>
<#@ assembly name="ChinookMetadata.dll" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System.Data" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Text.RegularExpressions" #>
<#@ import namespace="ChinookMetadata.Convert" #>
<#@ import namespace="ChinookMetadata.Schema" #>
<#@ include file="..\..\T4Templates\DataSetHelper.tt" #>
<#@ include file="..\..\T4Templates\Chinook.t4" #>
/*******************************************************************************
Chinook Database
Script: CreateDB.sql - Creates and populates the Chinook database.
DB Server: MySQL
Version: <#= GetVersionNumber() #>
Version: <#= DataSetHelper.GetVersionNumber() #>
License: http://www.codeplex.com/ChinookDatabase/license
********************************************************************************/

Expand All @@ -41,11 +36,11 @@ CREATE TABLE <#= table.TableName #>
foreach (DataColumn col in table.Columns)
{
#>
<#= col.ColumnName #> <#= GetMySqlType(col) #><#= (col.AllowDBNull ? "" : " NOT NULL") #><#= (col.AutoIncrement? " AUTO_INCREMENT" : "") #><#= (IsLastCreateTableElement(table, col) ? "" : ",") #>
<#= col.ColumnName #> <#= DataSetHelper.GetMySqlType(col) #><#= (col.AllowDBNull ? "" : " NOT NULL") #><#= (col.AutoIncrement? " AUTO_INCREMENT" : "") #><#= (DataSetHelper.IsLastCreateTableElement(table, col) ? "" : ",") #>
<#
} // foreach DataColumn
#>
PRIMARY KEY(<#= GetPrimaryKeyString (table) #>)
PRIMARY KEY(<#= DataSetHelper.GetPrimaryKeyString (table) #>)
);

<#
Expand Down
15 changes: 5 additions & 10 deletions Source/ChinookDatabase/Scripts/Oracle/CreateDB.tt
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
<#@ template language="C#" hostspecific="true"#>
<#@ template language="C#v3.5" hostspecific="True"#>
<#@ output extension="sql" #>
<#@ assembly name="System.dll" #>
<#@ assembly name="System.Xml.dll" #>
<#@ assembly name="System.Data.dll" #>
<#@ assembly name="ChinookMetadata.dll" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System.Data" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Text.RegularExpressions" #>
<#@ import namespace="ChinookMetadata.Convert" #>
<#@ import namespace="ChinookMetadata.Schema" #>
<#@ include file="..\..\T4Templates\DataSetHelper.tt" #>
<#@ include file="..\..\T4Templates\Chinook.t4" #>
/*******************************************************************************
Chinook Database
Script: CreateDB.sql - Creates and populates the Chinook database.
DB Server: Oracle
Version: <#= GetVersionNumber() #>
Version: <#= DataSetHelper.GetVersionNumber() #>
License: http://www.codeplex.com/ChinookDatabase/license
********************************************************************************/

Expand Down Expand Up @@ -53,12 +48,12 @@ CREATE TABLE <#= table.TableName #>
foreach (DataColumn col in table.Columns)
{
#>
<#= col.ColumnName #> <#= GetOracleType(col) #> <#= (col.AllowDBNull ? "" : "NOT NULL") #><#= (IsLastCreateTableElement(table, col) ? "" : ",") #>
<#= col.ColumnName #> <#= DataSetHelper.GetOracleType(col) #> <#= (col.AllowDBNull ? "" : "NOT NULL") #><#= (DataSetHelper.IsLastCreateTableElement(table, col) ? "" : ",") #>
<#
} // foreach DataColumn

#>
CONSTRAINT <#= GetPrimaryKeyConstraintName (table) #> PRIMARY KEY (<#= GetPrimaryKeyString(table) #>)
CONSTRAINT <#= DataSetHelper.GetPrimaryKeyConstraintName (table) #> PRIMARY KEY (<#= DataSetHelper.GetPrimaryKeyString(table) #>)
)
/

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?><ItemProperties xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><Properties><Property><Name>svn:ignore</Name><Value>[Bb]in
obj
[Dd]ebug
[Rr]elease
*.user
*.aps
*.eto
</Value></Property><Property><Name>svn:mime-type</Name><Value>application/octet-stream</Value></Property></Properties></ItemProperties>
Binary file modified Source/ChinookDatabase/Scripts/SqlServer/CreateDB.tt
Binary file not shown.
Binary file not shown.
Binary file not shown.
15 changes: 5 additions & 10 deletions Source/ChinookDatabase/Scripts/SqlServerCompact/CreateTables.tt
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
<#@ template language="C#" hostspecific="true"#>
<#@ template language="C#v3.5" hostspecific="true"#>
<#@ output extension="sqlce" #>
<#@ assembly name="System.dll" #>
<#@ assembly name="System.Xml.dll" #>
<#@ assembly name="System.Data.dll" #>
<#@ assembly name="ChinookMetadata.dll" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System.Data" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Text.RegularExpressions" #>
<#@ import namespace="ChinookMetadata.Convert" #>
<#@ import namespace="ChinookMetadata.Schema" #>
<#@ include file="..\..\T4Templates\DataSetHelper.tt" #>
<#@ include file="..\..\T4Templates\Chinook.t4" #>
/*******************************************************************************
Chinook Database
Script: CreateDB.sql - Creates and populates the Chinook database.
DB Server: SQL Server Compact
Version: <#= GetVersionNumber() #>
Version: <#= DataSetHelper.GetVersionNumber() #>
License: http://www.codeplex.com/ChinookDatabase/license
********************************************************************************/

Expand All @@ -38,11 +33,11 @@ CREATE TABLE <#= table.TableName #>
foreach (DataColumn col in table.Columns)
{
#>
<#= col.ColumnName #> <#= GetSqlServerType(col) #><#= (col.AllowDBNull ? "" : " NOT NULL") #><#= (col.AutoIncrement? " IDENTITY" : "") #><#= (IsLastCreateTableElement(table, col) ? "" : ",") #>
<#= col.ColumnName #> <#= DataSetHelper.GetSqlServerType(col) #><#= (col.AllowDBNull ? "" : " NOT NULL") #><#= (col.AutoIncrement? " IDENTITY" : "") #><#= (DataSetHelper.IsLastCreateTableElement(table, col) ? "" : ",") #>
<#
} // foreach DataColumn
#>
PRIMARY KEY(<#= GetPrimaryKeyString(table) #>)
PRIMARY KEY(<#= DataSetHelper.GetPrimaryKeyString(table) #>)
);

<#
Expand Down
11 changes: 3 additions & 8 deletions Source/ChinookDatabase/Scripts/SqlServerCompact/DropTables.tt
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
<#@ template language="C#" hostspecific="true"#>
<#@ template language="C#v3.5" hostspecific="True"#>
<#@ output extension="sqlce" #>
<#@ assembly name="System.dll" #>
<#@ assembly name="System.Xml.dll" #>
<#@ assembly name="System.Data.dll" #>
<#@ assembly name="ChinookMetadata.dll" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System.Data" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Text.RegularExpressions" #>
<#@ import namespace="ChinookMetadata.Convert" #>
<#@ import namespace="ChinookMetadata.Schema" #>
<#@ include file="..\..\T4Templates\DataSetHelper.tt" #>
<#@ include file="..\..\T4Templates\Chinook.t4" #>
/*******************************************************************************
Chinook Database
Script: CreateDB.sql - Creates and populates the Chinook database.
DB Server: SQL Server Compact
Version: <#= GetVersionNumber() #>
Version: <#= DataSetHelper.GetVersionNumber() #>
License: http://www.codeplex.com/ChinookDatabase/license
********************************************************************************/

Expand Down
Loading

0 comments on commit e1b2ae3

Please sign in to comment.