Table of Contents

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?)

public NpgsqlSnakeCaseNameTranslator(bool legacyMode, CultureInfo? culture = null)

Parameters

legacyMode bool

Uses the legacy naming convention if true, otherwise it uses the new naming convention.

culture CultureInfo

An 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?)

public NpgsqlSnakeCaseNameTranslator(CultureInfo? culture = null)

Parameters

culture CultureInfo

An 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 string

The value to convert.

culture CultureInfo

An 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

string

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

string

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

Returns

string