Skip to content

Commit

Permalink
Default to invariant culture when using static NpgsqlSnakeCaseNameTra…
Browse files Browse the repository at this point in the history
…nslator.ConvertToSnakeCase (#5448)

(cherry picked from commit 8822656)
  • Loading branch information
azygis authored and NinoFloris committed Jan 31, 2024
1 parent fa583c3 commit c70e5a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Npgsql/NameTranslation/NpgsqlSnakeCaseNameTranslator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ IEnumerable<string> LegacyModeMap(string clrName)
/// This will be used when converting names to lower case.
/// If <see langword="null"/> then <see cref="CultureInfo.InvariantCulture"/> will be used.
/// </param>
public static string ConvertToSnakeCase(string name, CultureInfo culture)
public static string ConvertToSnakeCase(string name, CultureInfo? culture = null)
{
if (string.IsNullOrEmpty(name))
return name;
Expand Down Expand Up @@ -115,7 +115,7 @@ public static string ConvertToSnakeCase(string name, CultureInfo culture)
builder.Append('_');
}

currentChar = char.ToLower(currentChar, culture);
currentChar = char.ToLower(currentChar, culture ?? CultureInfo.InvariantCulture);
break;

case UnicodeCategory.LowercaseLetter:
Expand Down
2 changes: 1 addition & 1 deletion src/Npgsql/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1868,7 +1868,7 @@ override sealed Npgsql.NpgsqlParameter.SourceColumnNullMapping.get -> bool
override sealed Npgsql.NpgsqlParameter.SourceColumnNullMapping.set -> void
override sealed Npgsql.NpgsqlParameter.SourceVersion.get -> System.Data.DataRowVersion
override sealed Npgsql.NpgsqlParameter.SourceVersion.set -> void
static Npgsql.NameTranslation.NpgsqlSnakeCaseNameTranslator.ConvertToSnakeCase(string! name, System.Globalization.CultureInfo! culture) -> string!
static Npgsql.NameTranslation.NpgsqlSnakeCaseNameTranslator.ConvertToSnakeCase(string! name, System.Globalization.CultureInfo? culture = null) -> string!
static Npgsql.NpgsqlCommandBuilder.DeriveParameters(Npgsql.NpgsqlCommand! command) -> void
static Npgsql.NpgsqlConnection.ClearAllPools() -> void
static Npgsql.NpgsqlConnection.ClearPool(Npgsql.NpgsqlConnection! connection) -> void
Expand Down

0 comments on commit c70e5a2

Please sign in to comment.