Search
ctrl/
Ask AI
Light
Dark
System

Connection Parameters

The EdgeDBClient constructor can accept an EdgeDBConnection class which specifies how the client should connect to EdgeDB. The main way to to construct a EdgeDBConnection is to use the static helper methods:

class

EdgeDBConnection

The TLSCertData property is obselete following version 1.0 and higher.

Represents a client-facing connection to EdgeDB.

Properties
  • Username (string) – The username used to connect to the database. Defaults to "edgedb".

  • Password (string?) – The password to connect to the database.

  • Hostname (string) – The hostname of the EdgeDB instance. Defaults to "127.0.0.1".

  • Port (int) – The port of the EdgeDB instance to connect to. Defaults to 5656.

  • Database (string?) – The database name to use when connecting. Defaults to "edgedb".

  • TLSSecurity (TLSSecurityMode) – The TLS security level. Defaults to TLSSecurityMode.Strict.

method

EdgeDBConnection.FromDSN()
EdgeDBConnection.FromDSN(string dsn): EdgeDBConnection

Creates a EdgeDBConnection from an EdgeDB DSN.

Arguments
  • dsn (string) – The DSN to create the connection from.

Returns

A EdgeDBConnection representing the DSN.

Throws
  • ArgumentException – A query parameter has already been defined in the DSN.

  • FormatException – Port was not in the correct format of int.

  • FileNotFoundException – A file parameter wasn’t found.

  • KeyNotFoundException – An environment variable couldn’t be found.

method

EdgeDBConnection.FromProjectFile()
EdgeDBConnection.FromProjectFile(string path): EdgeDBConnection

Creates a EdgeDBConnection from a .toml project file.

Arguments
  • path (string) – The path to the .toml project file.

Returns

A EdgeDBConnection representing the project defined in the .toml file.

Throws
  • FileNotFoundException – The supplied file path, credentials path, or instance-name file doesn’t exist.

  • DirectoryNotFoundException – The project directory doesn’t exist for the supplied toml file.

method

EdgeDBConnection.FromInstanceName()
EdgeDBConnection.FromInstanceName(string name): EdgeDBConnection

Creates a EdgeDBConnection from an instance name.

Arguments
  • name (string) – The name of the instance.

Returns

A EdgeDBConnection containing connection details for the specific instance.

Throws

FileNotFoundException – The instances config file couldn’t be found.

method

EdgeDBConnection.ResolveEdgeDBTOML()
EdgeDBConnection.ResolveEdgeDBTOML(): EdgeDBConnection

Resolves a connection by traversing the current working directory and its parents to find an edgedb.toml file.

Returns

A resolved EdgeDBConnection.

Throws

FileNotFoundException – No edgedb.toml file could be found.

method

EdgeDBConnection.Parse()
EdgeDBConnection.Parse(string? instance = null, string? dsn = null, Action<EdgeDBConnection>? configure = null, bool autoResolve = true): EdgeDBConnection

Parses the provided arguments to build a EdgeDBConnection; parse logic follows the Priority Levels of arguments.

Arguments
  • instance (string?) – The instance name to connect to.

  • dsn (string?) – The DSN string to use to connect.

  • configure (Action<EdgeDBConnection>?) – A configuration delegate.

  • autoResolve (bool) – Whether or not to autoresolve a connection using EdgeDBConnection.ResolveEdgeDBTOML().

Returns

A EdgeDBConnection that can be used to connect to a EdgeDB instance.

Throws
  • ConfigurationException – An error occured while parsing or configuring the EdgeDBConnection.

  • FileNotFoundException – A configuration file could not be found.