Table of Contents

Class CodeGenerationOptions

Namespace
LinqToDB.Scaffold
Assembly
linq2db.Tools.dll

General code-generation options, not related to data model directly.

public sealed class CodeGenerationOptions
Inheritance
CodeGenerationOptions
Extension Methods

Properties

AddGeneratedFileSuffix

Adds '.generated' suffix to files before extension.

  • Default: false
  • In T4 compability mode: false
public bool AddGeneratedFileSuffix { get; set; }

Property Value

bool

AutoGeneratedHeader

Optional header comment text on top of each generated file. Will be wrapped into <auto-generated> tag. Used only when MarkAsAutoGenerated is set. When null, default linq2db header text will be used.

public string? AutoGeneratedHeader { get; set; }

Property Value

string

ClassPerFile

Enables class-per-file generation. Otherwise all code will be generated in single file.

  • Default: true
  • In T4 compability mode: false
public bool ClassPerFile { get; set; }

Property Value

bool

ConflictingNames

List of type and/or namespace names that conflict with generated code. Used to adjust code-generation to resolve conflicts. Name should include both namespace and type name (for types) with dot as namespace separator and plus as nested class separator. E.g. My.Namespace.SomeType+NestedType.

  • Default: empty
  • In T4 compability mode: empty
public ISet<string> ConflictingNames { get; }

Property Value

ISet<string>

EnableNullableReferenceTypes

Enables generation of nullable reference type annotations in generated code. Ignored if target language doesn't support nullable reference types.

  • Default: true
  • In T4 compability mode: true
public bool EnableNullableReferenceTypes { get; set; }

Property Value

bool

Indent

Gets or sets string, used for a single indentation level in generated code.

  • Default: "\t"
  • In T4 compability mode: "\t"
public string Indent { get; set; }

Property Value

string

MarkAsAutoGenerated

Adds <auto-generated /> comment to generated code.

  • Default: true
  • In T4 compability mode: true
public bool MarkAsAutoGenerated { get; set; }

Property Value

bool

Namespace

Gets or sets namespace name for generated code.

  • Default: "DataModel"
  • In T4 compability mode: "DataModel"
public string? Namespace { get; set; }

Property Value

string

NewLine

Gets or sets string, used as newline sequence in generated code.

  • Default: NewLine
  • In T4 compability mode: "\r\n"
public string NewLine { get; set; }

Property Value

string

SuppressMissingXmlDocWarnings

Enables suppression of missing XML documentation warnings in generated code. Applicable only to code, generated without <auto-generated /> comment.

  • Default: true
  • In T4 compability mode: true (both CS1573 and CS1591, T4 supporessed only CS1591)
public bool SuppressMissingXmlDocWarnings { get; set; }

Property Value

bool