dotConnect for PostgreSQL Documentation
DbConnectionStringBuilder Class
Members  Example  See Also
Devart.Common Namespace : DbConnectionStringBuilder Class

Generates automatically connection strings used to connect to a data source.

Inheritance Hierarchy



Visual Basic (Declaration) 
Public Class DbConnectionStringBuilder 
   Inherits System.Data.Common.DbConnectionStringBuilder
   Implements ICollectionIDictionaryIEnumerableICustomTypeDescriptor 


The DbConnectionStringBuilder class provides the base class from which the strongly typed connection string builders (Devart.Data.PostgreSql.PgSqlConnectionStringBuilder) are derived. The connection string builders let developers programmatically create syntactically correct connection strings, and parse and rebuild existing connection strings. The DbConnectionStringBuilder has been defined in a data source-agnostic manner. Because of the addition of the Devart.Common namespace, developers require a base class against which they can program in order to build connection strings that can work against an arbitrary database. But it is possible using this class to create invalid connection strings. It is recommended to use the strongly typed connection string builders (Devart.Data.PostgreSql.PgSqlConnectionStringBuilder and so on) because they support only key/value pairs that are supported by particular data source; trying to add invalid pairs will throw an exception. For more information, refer to the description of the System.Data.Common.DbConnectionStringBuilder class in MSDN.


C#csharpCopy Code
Devart.Common.DbConnectionStringBuilder csb = new Devart.Common.DbConnectionStringBuilder();
csb["Host"] = "server";
csb["Port"] = 3306;
csb["User Id"] = "postgres";
csb["Password"] = "postgres";
csb["Database"] = "test";
csb["Max Pool Size"] = 150;
csb["Connection Timeout"] = 30;
Devart.Data.PostgreSql.PgSqlConnection myConnection = new Devart.Data.PostgreSql.PgSqlConnection(csb.ConnectionString);
C#Visual BasicCopy Code
Dim csb As Devart.Common.DbConnectionStringBuilder = New Devart.Common.DbConnectionStringBuilder
csb("Host") = "server"
csb("Port") = 3306
csb("User Id") = "postgres"
csb("Password") = "postgres"
csb("Database") = "test"
csb("Max Pool Size") = 150
csb("Connection Timeout") = 30
Dim myConnection As Devart.Data.PostgreSql.PgSqlConnection = New Devart.Data.PostgreSql.PgSqlConnection(csb.ConnectionString)


Namespace: Devart.Common

Platforms:Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7, Windows 8, Windows 10, Windows Server 2012 family.

See Also