Table of Contents

Class BaseCodeGenerator

Namespace
JD.Domain.Generators.Core
Assembly
JD.Domain.Generators.Core.dll

Base class for code generators providing common functionality.

public abstract class BaseCodeGenerator : ICodeGenerator
Inheritance
BaseCodeGenerator
Implements
Derived
Inherited Members

Properties

Name

Gets the name of this generator.

public abstract string Name { get; }

Property Value

string

Methods

CanGenerate(GeneratorContext)

Determines if this generator can process the given manifest. Default implementation returns true if manifest is not null.

public virtual bool CanGenerate(GeneratorContext context)

Parameters

context GeneratorContext

Returns

bool

CreateCodeBuilder(string?)

Creates a code builder with standard auto-generated header.

protected CodeBuilder CreateCodeBuilder(string? version = null)

Parameters

version string

Returns

CodeBuilder

CreateGeneratedFile(string, string)

Creates a generated file with computed hash.

protected GeneratedFile CreateGeneratedFile(string fileName, string content)

Parameters

fileName string
content string

Returns

GeneratedFile

Generate(GeneratorContext, CancellationToken)

Generates code files from the given context.

public abstract IEnumerable<GeneratedFile> Generate(GeneratorContext context, CancellationToken cancellationToken = default)

Parameters

context GeneratorContext
cancellationToken CancellationToken

Returns

IEnumerable<GeneratedFile>