Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit c75d68d

Browse files
author
WimAtIHomer
committed
Update src/T4/OrmLite.Poco.tt
Added multifile support with Manager.tt from Damien Guard added in OrmLite.Core.ttinclude
1 parent 26311cc commit c75d68d

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

src/T4/OrmLite.Poco.tt

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
<#@ include file="OrmLite.Core.ttinclude" #>
1+
<#@ include file="OrmLite.Core.ttinclude" #>
22
<#
33
// Settings
4-
ConnectionStringName = ""; // Uses last connection string in config if not specified
5-
Namespace = "";
6-
RepoName = "";
7-
GenerateOperations = true;
8-
GeneratePocos = true;
9-
GenerateCommon = true;
4+
ConnectionStringName = "PressDB"; // Uses last connection string in config if not specified
5+
Namespace = "IQM.Data";
106
ClassPrefix = "";
117
ClassSuffix = "";
12-
TrackModifiedColumns = false;
8+
bool SplitIntoMultipleFiles = true;
139

1410
// Read schema
1511
var tables = LoadTables();
@@ -30,10 +26,16 @@
3026
#>
3127
<#
3228
if (string.IsNullOrEmpty(Namespace)) Namespace=ConnectionStringName;
33-
if (string.IsNullOrEmpty(RepoName) && !string.IsNullOrEmpty(ConnectionStringName)) RepoName=ConnectionStringName + "DB";
3429
if (string.IsNullOrEmpty(Namespace)) Namespace="OrmLitePoco";
35-
if (string.IsNullOrEmpty(RepoName)) RepoName="PocoDB";
36-
#>
30+
var manager = Manager.Create(Host, GenerationEnvironment);
31+
manager.StartHeader(); #>// <auto-generated />
32+
// This file was generated by a T4 template.
33+
// Don't change it directly as your change would get overwritten. Instead, make changes
34+
// to the .tt file (i.e. the T4 template) and save it to regenerate this file.
35+
36+
// Make sure the compiler doesn't complain about missing Xml comments
37+
#pragma warning disable 1591
38+
3739
using System;
3840
using System.Collections.Generic;
3941
using System.Linq;
@@ -45,11 +47,13 @@ using ServiceStack.DesignPatterns.Model;
4547

4648
namespace <#=Namespace #>
4749
{
50+
<#manager.EndBlock(); #>
4851
<#
4952
foreach(Table tbl in from t in tables where !t.Ignore select t)
5053
{
54+
manager.StartNewFile(tbl.Name + ".cs");
5155
#>
52-
56+
5357
[Alias("<#=tbl.Name#>")]
5458
public partial class <#=tbl.ClassName#><#if (tbl.HasPK()) { #> : IHasId<<#=tbl.PK.PropertyType#>><#}#>
5559
{
@@ -71,8 +75,13 @@ foreach(Column col in from c in tbl.Columns where !c.Ignore select c)
7175
<#}#>
7276
<# } #>
7377
}
74-
<# } #>
78+
<# manager.EndBlock(); #>
79+
<# } #>
80+
<#manager.StartFooter(); #>
7581
}
76-
<# } #>
82+
#pragma warning restore 1591
83+
<#manager.EndBlock(); #>
84+
<#manager.Process(SplitIntoMultipleFiles); #>
85+
<# } #>
7786

7887

0 commit comments

Comments
 (0)