Skip to content

Discrepancy between NpgsqlConnectionStringBuilder.Keys and NpgsqlConnectionStringBuilder.ContainsKey #6463

Description

@KeterSCP

I need to determine whether pooling was explicitly set on the base connection string. I thought I could do that by using NpgsqlConnectionStringBuilder.ContainsKey, however it always returns true.

Repro:

const string connectionString = "Server=localhost;Port=5432;Database=db;User Id=postgres;Password=postgres;";

var csBuilder = new NpgsqlConnectionStringBuilder(connectionString);

Console.WriteLine($"ContainsKey Pooling: {csBuilder.ContainsKey("Pooling")}");

Console.WriteLine("== Keys ==");
foreach (var builderKey in csBuilder.Keys)
{
    Console.WriteLine(builderKey);
}

Output:

ContainsKey Pooling: True
== Keys ==
Host
Port
Database
Username
Password

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions