Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not capitalize #2732

Merged
merged 1 commit into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 _;");
Expand Down Expand Up @@ -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},");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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},");
Expand Down