From e426225fdb255b1d76d724dd85414bd0fa8d9bb6 Mon Sep 17 00:00:00 2001 From: Erik Ejlskov Jensen Date: Sat, 14 Dec 2024 16:09:13 +0100 Subject: [PATCH] Do not capitalize --- .../Procedures/PostgresStoredProcedureScaffolder.cs | 12 +++++++----- .../Procedures/SqlServerStoredProcedureScaffolder.cs | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/Core/RevEng.Core.80/Routines/Procedures/PostgresStoredProcedureScaffolder.cs b/src/Core/RevEng.Core.80/Routines/Procedures/PostgresStoredProcedureScaffolder.cs index 6e7baa889..57f35a351 100644 --- a/src/Core/RevEng.Core.80/Routines/Procedures/PostgresStoredProcedureScaffolder.cs +++ b/src/Core/RevEng.Core.80/Routines/Procedures/PostgresStoredProcedureScaffolder.cs @@ -45,13 +45,13 @@ protected override void GenerateProcedure(Routine procedure, RoutineModel model, ArgumentNullException.ThrowIfNull(procedure); var paramStrings = procedure.Parameters.Where(p => !p.Output) - .Select(p => $"{Code.Reference(p.ClrTypeFromNpgsqlParameter(asMethodParameter: true))} {Code.Identifier(p.Name)}") + .Select(p => $"{Code.Reference(p.ClrTypeFromNpgsqlParameter(asMethodParameter: true))} {Code.Identifier(p.Name, capitalize: false)}") .ToList(); var outParams = procedure.Parameters.Where(p => p.Output).ToList(); var outParamStrings = outParams - .Select(p => $"OutputParameter<{Code.Reference(p.ClrTypeFromNpgsqlParameter())}> {Code.Identifier(p.Name)}") + .Select(p => $"OutputParameter<{Code.Reference(p.ClrTypeFromNpgsqlParameter())}> {Code.Identifier(p.Name, capitalize: false)}") .ToList(); var fullExec = GenerateProcedureStatement(procedure, useAsyncCalls); @@ -125,7 +125,7 @@ protected override void GenerateProcedure(Routine procedure, RoutineModel model, foreach (var parameter in outParams) { - Sb.AppendLine($"{Code.Identifier(parameter.Name)}.SetValue({ParameterPrefix}{parameter.Name}.Value);"); + Sb.AppendLine($"{Code.Identifier(parameter.Name, capitalize: false)}.SetValue({ParameterPrefix}{parameter.Name}.Value);"); } Sb.AppendLine("return _;"); @@ -248,10 +248,12 @@ private void GenerateParameter(ModuleParameter parameter) private void AppendValue(ModuleParameter parameter) { - var value = parameter.Nullable ? $"{Code.Identifier(parameter.Name)} ?? Convert.DBNull" : $"{Code.Identifier(parameter.Name)}"; + var name = Code.Identifier(parameter.Name, capitalize: false); + + var value = parameter.Nullable ? $"{name} ?? Convert.DBNull" : $"{name}"; if (parameter.Output) { - value = parameter.Nullable ? $"{Code.Identifier(parameter.Name)}?._value ?? Convert.DBNull" : $"{Code.Identifier(parameter.Name)}?._value"; + value = parameter.Nullable ? $"{name}?._value ?? Convert.DBNull" : $"{name}?._value"; } Sb.AppendLine($"Value = {value},"); diff --git a/src/Core/RevEng.Core.80/Routines/Procedures/SqlServerStoredProcedureScaffolder.cs b/src/Core/RevEng.Core.80/Routines/Procedures/SqlServerStoredProcedureScaffolder.cs index a6f726df2..51fdf7fee 100644 --- a/src/Core/RevEng.Core.80/Routines/Procedures/SqlServerStoredProcedureScaffolder.cs +++ b/src/Core/RevEng.Core.80/Routines/Procedures/SqlServerStoredProcedureScaffolder.cs @@ -44,7 +44,7 @@ protected override void GenerateProcedure(Routine procedure, RoutineModel model, ArgumentNullException.ThrowIfNull(procedure); var paramStrings = procedure.Parameters.Where(p => !p.Output) - .Select(p => $"{Code.Reference(p.ClrTypeFromSqlParameter(asMethodParameter: true))} {Code.Identifier(p.Name)}") + .Select(p => $"{Code.Reference(p.ClrTypeFromSqlParameter(asMethodParameter: true))} {Code.Identifier(p.Name, capitalize: false)}") .ToList(); var allOutParams = procedure.Parameters.Where(p => p.Output).ToList(); @@ -54,7 +54,7 @@ protected override void GenerateProcedure(Routine procedure, RoutineModel model, var retValueName = allOutParams[allOutParams.Count - 1].Name; var outParamStrings = outParams - .Select(p => $"OutputParameter<{Code.Reference(p.ClrTypeFromSqlParameter())}> {Code.Identifier(p.Name)}") + .Select(p => $"OutputParameter<{Code.Reference(p.ClrTypeFromSqlParameter())}> {Code.Identifier(p.Name, capitalize: false)}") .ToList(); var fullExec = GenerateProcedureStatement(procedure, retValueName, useAsyncCalls); @@ -152,7 +152,7 @@ protected override void GenerateProcedure(Routine procedure, RoutineModel model, foreach (var parameter in outParams) { - Sb.AppendLine($"{Code.Identifier(parameter.Name)}?.SetValue({ParameterPrefix}{parameter.Name}.Value);"); + Sb.AppendLine($"{Code.Identifier(parameter.Name, capitalize: false)}?.SetValue({ParameterPrefix}{parameter.Name}.Value);"); } if (procedure.SupportsMultipleResultSet) @@ -361,10 +361,12 @@ private void GenerateParameter(ModuleParameter parameter, Routine procedure) private void AppendValue(ModuleParameter parameter) { - var value = parameter.Nullable ? $"{Code.Identifier(parameter.Name)} ?? Convert.DBNull" : $"{Code.Identifier(parameter.Name)}"; + var name = Code.Identifier(parameter.Name, capitalize: false); + + var value = parameter.Nullable ? $"{name} ?? Convert.DBNull" : $"{name}"; if (parameter.Output) { - value = parameter.Nullable ? $"{Code.Identifier(parameter.Name)}?._value ?? Convert.DBNull" : $"{Code.Identifier(parameter.Name)}?._value"; + value = parameter.Nullable ? $"{name}?._value ?? Convert.DBNull" : $"{name}?._value"; } Sb.AppendLine($"Value = {value},");