Skip to content

ExtensionControlFile

Namespace: Ankus.PgConfig

Assembly: Ankus.PgConfig.dll

Reads and writes PostgreSQL extension control assignments without loading native code.

public static class ExtensionControlFile

Control files use ASCII because PostgreSQL cannot determine their encoding. Comments, optional equals signs, quoted values, doubled quotes, backslash escapes, and last-assignment precedence follow PostgreSQL’s configuration syntax. Include directives are not supported. Parameter names and values are otherwise interpreted by the selected PostgreSQL version, not by this text codec.

Inheritance: object

Format(IReadOnlyDictionary<string, string>)

Section titled “Format(IReadOnlyDictionary<string, string>)”

Formats assignments in ordinal name order with PostgreSQL string escaping.

public static string Format(IReadOnlyDictionary<string, string> values)

Parameters:

values — IReadOnlyDictionary<string, string>

The exact decoded assignments.

Returns: string

ASCII control text with LF line endings.

Exceptions:

Parses control text without changing its values or reading additional files.

public static IReadOnlyDictionary<string, string> Parse(string text)

Parameters:

text — string

ASCII control assignments.

Returns: IReadOnlyDictionary<string, string>

The case-sensitive parameter names and decoded values.

Exceptions:

Reads a control file and returns its immutable assignments.

public static IReadOnlyDictionary<string, string> Read(string path)

Parameters:

path — string

The control file path.

Returns: IReadOnlyDictionary<string, string>

The case-sensitive parameter names and decoded values.

Exceptions:

  • FormatException: The file contains invalid or unsupported control syntax.