Domanda

The way I understand it, FbClient uses the ADO.NET to make the db connection. ADO.NET optimizes connection pooling. With that in mind, should I set the Pooling option = true in the connection string or should I leave it blank. Below are two connection strings, which one would be better to use with FbClient?

connectionString="User=******;Password=********;Database=CBT;DataSource=localhost;Port=3050;Dialect=3;Charset=UTF8;Role=;Connection lifetime=15;Pooling=true;MinPoolSize=0;MaxPoolSize=50;"

or

connectionString="User=******;Password=********;Database=CBT;DataSource=localhost;Port=3050;Dialect=3;Charset=UTF8;Role=;Connection lifetime=15;"
È stato utile?

Soluzione

You don't have to enable pooling explicitly, because it is enabled by default.

See: https://github.com/cincuranet/NETProvider/blob/master/NETProvider/source/FirebirdSql/Data/FirebirdClient/FbConnectionString.cs#L376

private void SetDefaultOptions()
{
    if (this.options == null)
    {
        this.options = new Dictionary<string, object>();
    }

    this.options.Clear();

    // Add default key pairs values
    /* ... */
    this.options.Add("pooling", true);
    this.options.Add("connection lifetime", 0);
    this.options.Add("min pool size", 0);
    this.options.Add("max pool size", 100);
    this.options.Add("connection timeout", 15);
    /* ... */
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top