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
contentstring
Returns
EscapeStringLiteral(string)
Escapes a string for use in C# string literals.
public static string EscapeStringLiteral(string value)
Parameters
valuestring
Returns
FormatTypeName(Type)
Formats a type name for code generation.
public static string FormatTypeName(Type type)
Parameters
typeType
Returns
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
Returns
NormalizeLineEndings(string)
Normalizes line endings for consistent output across platforms.
public static string NormalizeLineEndings(string content)
Parameters
contentstring
Returns
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
sourceIEnumerable<T>keySelectorFunc<T, TKey>
Returns
- IEnumerable<T>
Type Parameters
TTKey
ToIdentifier(string)
Generates a valid C# identifier from the given name.
public static string ToIdentifier(string name)
Parameters
namestring