ICodeTemplate
Interface for code generation templates that can be customized by users
public interface ICodeTemplate
Methods
GenerateModelType(string, IReadOnlyList<DatabaseColumn>)
Result<string, SqlError> GenerateModelType(string typeName, IReadOnlyList<DatabaseColumn> columns)
Generates the model/record type definition
Parameters:
| Name | Type | Description |
|---|---|---|
typeName |
String |
Name of the type to generate |
columns |
DatabaseColumn> |
Database columns metadata |
Returns: SqlError> - Generated C# code for the model type
GenerateDataAccessMethod(string, string, string, IReadOnlyList<ParameterInfo>, IReadOnlyList<DatabaseColumn>)
Result<string, SqlError> GenerateDataAccessMethod(string methodName, string returnTypeName, string sql, IReadOnlyList<ParameterInfo> parameters, IReadOnlyList<DatabaseColumn> columns)
Generates the data access extension method
Parameters:
| Name | Type | Description |
|---|---|---|
methodName |
String |
Name of the extension method |
returnTypeName |
String |
Name of the return type |
sql |
String |
SQL query text |
parameters |
ParameterInfo> |
SQL parameters |
columns |
DatabaseColumn> |
Database columns metadata |
Returns: SqlError> - Generated C# code for the extension method
GenerateSourceFile(string, string, string)
Result<string, SqlError> GenerateSourceFile(string namespaceName, string modelCode, string dataAccessCode)
Generates the complete source file with usings, namespace, and all generated code
Parameters:
| Name | Type | Description |
|---|---|---|
namespaceName |
String |
Target namespace |
modelCode |
String |
Generated model type code |
dataAccessCode |
String |
Generated data access code |
Returns: SqlError> - Complete C# source file content
GenerateGroupedModels(GroupingConfig, IReadOnlyList<DatabaseColumn>)
Result<string, SqlError> GenerateGroupedModels(GroupingConfig groupingConfig, IReadOnlyList<DatabaseColumn> columns)
Generates grouped parent-child model types
Parameters:
| Name | Type | Description |
|---|---|---|
groupingConfig |
GroupingConfig |
Configuration for parent-child grouping |
columns |
DatabaseColumn> |
Database columns metadata |
Returns: SqlError> - Generated C# code for grouped models