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

Commit a305464

Browse files
committed
Merge pull request #398 from Layoric/t4-schema-attribute
T4 schema attribute
2 parents ea1b1e4 + d165928 commit a305464

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/T4/OrmLite.Poco.tt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
bool SplitIntoMultipleFiles = false; // if true: Generates one file for every class
99
bool MakeSingular = true; // if true: Changes the classname to singular if tablename is not singular
1010
bool UseIdAsPK = true; // if true: Changes the primary key property name to Id
11-
bool GenerateConstructor = false; // if true: Generates the default empty constructor
11+
bool GenerateConstructor = false; // if true: Generates the default empty constructor
12+
bool UseSchemaAttribute = true; // if true: Adds explicit '[Schema]' attribute
1213

1314
// Read schema
1415
var tables = LoadTables(MakeSingular);
@@ -58,6 +59,9 @@ manager.StartNewFile(tbl.Name + ".cs");
5859
#>
5960
<# if (MakeSingular) {#>
6061
[Alias("<#=tbl.Name#>")]
62+
<#}#>
63+
<# if (UseSchemaAttribute && !string.IsNullOrEmpty(tbl.Schema)) {#>
64+
[Schema("<#=tbl.Schema#>")]
6165
<#}#>
6266
public partial class <#=tbl.ClassName#><#if (tbl.HasPK() && UseIdAsPK) { #> : IHasId<<#=tbl.PK.PropertyType#>><#}#>
6367
{

0 commit comments

Comments
 (0)