dotConnect for PostgreSQL Documentation
Devart.Common Namespace / DbConnectionStringBuilder Class
Members Example

In This Topic
    DbConnectionStringBuilder Class
    In This Topic
    Generates automatically connection strings used to connect to a data source.
    Syntax
    Remarks
    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.
    Example
    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);
    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)
    Inheritance Hierarchy

    System.Object
       System.Data.Common.DbConnectionStringBuilder
          Devart.Common.DbConnectionStringBuilder
             Devart.Data.PostgreSql.PgSqlConnectionStringBuilder

    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also