Class NpgsqlSnakeCaseNameTranslator
- Namespace
- Npgsql.NameTranslation
- Assembly
- Npgsql.dll
A name translator which converts standard CLR names (e.g. SomeClass) to snake-case database names (some_class)
public sealed class NpgsqlSnakeCaseNameTranslator : INpgsqlNameTranslator
- Inheritance
-
NpgsqlSnakeCaseNameTranslator
- Implements
- Inherited Members
Constructors
NpgsqlSnakeCaseNameTranslator(bool, CultureInfo?)
Creates a new NpgsqlSnakeCaseNameTranslator.
public NpgsqlSnakeCaseNameTranslator(bool legacyMode, CultureInfo? culture = null)
Parameters
legacyMode
boolUses the legacy naming convention if true, otherwise it uses the new naming convention.
culture
CultureInfoAn object that supplies culture-specific casing rules. This will be used when converting names to lower case. If null then InvariantCulture will be used.
NpgsqlSnakeCaseNameTranslator(CultureInfo?)
Creates a new NpgsqlSnakeCaseNameTranslator.
public NpgsqlSnakeCaseNameTranslator(CultureInfo? culture = null)
Parameters
culture
CultureInfoAn object that supplies culture-specific casing rules. This will be used when converting names to lower case. If null then InvariantCulture will be used.
Methods
ConvertToSnakeCase(string, CultureInfo?)
Converts a string to its snake_case equivalent.
public static string ConvertToSnakeCase(string name, CultureInfo? culture = null)
Parameters
name
stringThe value to convert.
culture
CultureInfoAn object that supplies culture-specific casing rules. This will be used when converting names to lower case. If null then InvariantCulture will be used.
Returns
TranslateMemberName(string)
Given a CLR member name (property or field), translates its name to a database type name.
public string TranslateMemberName(string clrName)
Parameters
clrName
string
Returns
TranslateTypeName(string)
Given a CLR type name (e.g class, struct, enum), translates its name to a database type name.
public string TranslateTypeName(string clrName)
Parameters
clrName
string