|
98 | 98 | public static bool UsePrivateSetterForComputedColumns = true; // If the columns is computed, use a private setter. |
99 | 99 | public static bool IncludeGeneratorVersionInCode = false; // If true, will include the version number of the generator in the generated code (Settings.ShowLicenseInfo must also be true). |
100 | 100 | public static bool TrimCharFields = false; // EF Core option only. If true, will TrimEnd() 'char' fields when read from the database. |
| 101 | + public static bool IncludeFieldNameConstants = false; // Will include public const string {{NameHumanCase}}Field = "{{NameHumanCase}}"; in the generated POCO class. It allows you to use a constant instead of magic strings. |
101 | 102 | public static List<string> AdditionalNamespaces = new List<string>(); // To include extra namespaces, include them here. i.e. "Microsoft.AspNet.Identity.EntityFramework" |
102 | 103 | public static List<string> AdditionalContextInterfaceItems = new List<string>(); // example: "void SetAutoDetectChangesEnabled(bool flag);" |
103 | 104 | public static List<string> AdditionalFileHeaderText = new List<string>(); // This will put additional lines verbatim at the top of each file under the comments, 1 line per entry |
|
3893 | 3894 | SummaryComments = !string.IsNullOrEmpty(col.SummaryComments) ? SecurityElement.Escape(col.SummaryComments) : null, |
3894 | 3895 | Attributes = col.Attributes, |
3895 | 3896 | OverrideModifier = col.OverrideModifier, |
| 3897 | + IncludeFieldNameConstants = Settings.IncludeFieldNameConstants, |
3896 | 3898 | WrapIfNullable = col.WrapIfNullable(), |
3897 | 3899 | NameHumanCase = col.NameHumanCase, |
3898 | 3900 | PrivateSetterForComputedColumns = Settings.UsePrivateSetterForComputedColumns && col.IsComputed ? "private " : string.Empty, |
@@ -17351,6 +17353,7 @@ SELECT SERVERPROPERTY('Edition') AS Edition, |
17351 | 17353 | public string SummaryComments { get; set; } |
17352 | 17354 | public List<string> Attributes { get; set; } |
17353 | 17355 | public bool OverrideModifier { get; set; } |
| 17356 | + public bool IncludeFieldNameConstants { get; set; } |
17354 | 17357 | public string WrapIfNullable { get; set; } |
17355 | 17358 | public string NameHumanCase { get; set; } |
17356 | 17359 | public string PrivateSetterForComputedColumns { get; set; } |
@@ -18543,6 +18546,7 @@ using {{this}};{{#newline}} |
18543 | 18546 | {{this}}{{#newline}} |
18544 | 18547 | {{/each}} |
18545 | 18548 | public {{#if OverrideModifier}}override {{/if}}{{WrapIfNullable}} {{NameHumanCase}} { get; {{PrivateSetterForComputedColumns}}set; }{{PropertyInitialisers}}{{InlineComments}}{{#newline}} |
| 18549 | +{{#if IncludeFieldNameConstants}} public const string {{NameHumanCase}}Field = ""{{NameHumanCase}}"";{{#newline}}{{/if}} |
18546 | 18550 | {{/each}} |
18547 | 18551 |
|
18548 | 18552 | {{#if HasReverseNavigation}} |
@@ -20032,6 +20036,7 @@ public class FakeDbContextTransaction : IDbContextTransaction{{#newline}} |
20032 | 20036 | {{this}}{{#newline}} |
20033 | 20037 | {{/each}} |
20034 | 20038 | public {{#if OverrideModifier}}override {{/if}}{{WrapIfNullable}} {{NameHumanCase}} { get; {{PrivateSetterForComputedColumns}}set; }{{PropertyInitialisers}}{{InlineComments}}{{#newline}} |
| 20039 | +{{#if IncludeFieldNameConstants}} public const string {{NameHumanCase}}Field = ""{{NameHumanCase}}"";{{#newline}}{{/if}} |
20035 | 20040 | {{/each}} |
20036 | 20041 |
|
20037 | 20042 | {{#if HasReverseNavigation}} |
@@ -21616,6 +21621,7 @@ public class FakeDbContextTransaction : IDbContextTransaction{{#newline}} |
21616 | 21621 | {{this}}{{#newline}} |
21617 | 21622 | {{/each}} |
21618 | 21623 | public {{#if OverrideModifier}}override {{/if}}{{WrapIfNullable}} {{NameHumanCase}} { get; {{PrivateSetterForComputedColumns}}set; }{{PropertyInitialisers}}{{InlineComments}}{{#newline}} |
| 21624 | +{{#if IncludeFieldNameConstants}} public const string {{NameHumanCase}}Field = ""{{NameHumanCase}}"";{{#newline}}{{/if}} |
21619 | 21625 | {{/each}} |
21620 | 21626 |
|
21621 | 21627 | {{#if HasReverseNavigation}} |
@@ -23248,6 +23254,7 @@ public class FakeDbContextTransaction : IDbContextTransaction{{#newline}} |
23248 | 23254 | {{this}}{{#newline}} |
23249 | 23255 | {{/each}} |
23250 | 23256 | public {{#if OverrideModifier}}override {{/if}}{{WrapIfNullable}} {{NameHumanCase}} { get; {{PrivateSetterForComputedColumns}}set; }{{PropertyInitialisers}}{{InlineComments}}{{#newline}} |
| 23257 | +{{#if IncludeFieldNameConstants}} public const string {{NameHumanCase}}Field = ""{{NameHumanCase}}"";{{#newline}}{{/if}} |
23251 | 23258 | {{/each}} |
23252 | 23259 |
|
23253 | 23260 | {{#if HasReverseNavigation}} |
@@ -24885,6 +24892,7 @@ public class FakeDbContextTransaction : IDbContextTransaction{{#newline}} |
24885 | 24892 | {{this}}{{#newline}} |
24886 | 24893 | {{/each}} |
24887 | 24894 | public {{#if OverrideModifier}}override {{/if}}{{WrapIfNullable}} {{NameHumanCase}} { get; {{PrivateSetterForComputedColumns}}set; }{{PropertyInitialisers}}{{InlineComments}}{{#newline}} |
| 24895 | +{{#if IncludeFieldNameConstants}} public const string {{NameHumanCase}}Field = ""{{NameHumanCase}}"";{{#newline}}{{/if}} |
24888 | 24896 | {{/each}} |
24889 | 24897 |
|
24890 | 24898 | {{#if HasReverseNavigation}} |
@@ -26529,6 +26537,7 @@ public class FakeDbContextTransaction : IDbContextTransaction{{#newline}} |
26529 | 26537 | {{this}}{{#newline}} |
26530 | 26538 | {{/each}} |
26531 | 26539 | public {{#if OverrideModifier}}override {{/if}}{{WrapIfNullable}} {{NameHumanCase}} { get; {{PrivateSetterForComputedColumns}}set; }{{PropertyInitialisers}}{{InlineComments}}{{#newline}} |
| 26540 | +{{#if IncludeFieldNameConstants}} public const string {{NameHumanCase}}Field = ""{{NameHumanCase}}"";{{#newline}}{{/if}} |
26532 | 26541 | {{/each}} |
26533 | 26542 |
|
26534 | 26543 | {{#if HasReverseNavigation}} |
|
0 commit comments