Table of Contents

Class GeneratorUtilities

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

Utility methods for code generation.

public static class GeneratorUtilities
Inheritance
GeneratorUtilities
Inherited Members

Methods

ComputeHash(string)

Computes a stable hash of the given content for change detection.

public static string ComputeHash(string content)

Parameters

content string

Returns

string

EscapeStringLiteral(string)

Escapes a string for use in C# string literals.

public static string EscapeStringLiteral(string value)

Parameters

value string

Returns

string

FormatTypeName(Type)

Formats a type name for code generation.

public static string FormatTypeName(Type type)

Parameters

type Type

Returns

string

GenerateFileName(string, string, string)

Generates a deterministic file name from entity or type name.

public static string GenerateFileName(string baseName, string suffix, string extension = ".g.cs")

Parameters

baseName string
suffix string
extension string

Returns

string

NormalizeLineEndings(string)

Normalizes line endings for consistent output across platforms.

public static string NormalizeLineEndings(string content)

Parameters

content string

Returns

string

SortDeterministically<T, TKey>(IEnumerable<T>, Func<T, TKey>)

Sorts a collection of items deterministically for stable output.

public static IEnumerable<T> SortDeterministically<T, TKey>(this IEnumerable<T> source, Func<T, TKey> keySelector) where TKey : IComparable<TKey>

Parameters

source IEnumerable<T>
keySelector Func<T, TKey>

Returns

IEnumerable<T>

Type Parameters

T
TKey

ToIdentifier(string)

Generates a valid C# identifier from the given name.

public static string ToIdentifier(string name)

Parameters

name string

Returns

string