Skip to content

Editing template to include double-quotes around fields. #741

@MarkLFT

Description

@MarkLFT

I am trying to add a const string with the field name of each field to allow the use of strongly typed field names instead of magic strings. Our previous ORM created these automatically and they are very useful. For example:

public bool IsAllowed {get; set; }
public const string IsAllowedField = "IsAllowed";

To achieve this here I tried adding the following to the ttinclude file

public {{#if OverrideModifier}}override {{/if}}{{WrapIfNullable}} {{NameHumanCase}} { get; {{PrivateSetterForComputedColumns}}set; }{{PropertyInitialisers}}{{InlineComments}}{{#newline}}
public const string {{NameHumanCase}}Field = "{{NameHumanCase}}"; {{#newline}}

The problem I have is the double quotes around the fieldname in the second line. (The first line is shown to show location only)
I have tried """, I have tried /", I have tried '/"', and after dozens of hours of searching, and trial and error, I am unable to find the correct way to do this. Can you please help.

The addition of this line might also be helpful for others to avoid the use of magic strings.

Thanks for any advise you can give,

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions