Skip to content

Consider our story for user-exposed type inference/mapping information #4690

@roji

Description

@roji

For some dynamic applications, it's important to be able to know e.g. which PG type is mapped to a given CLR type, or vice-versa. Our answer for this has always been to use NpgsqlParameter:

var p = new NpgsqlParameter();
p.Value = /* some CLR type */;
Console.WriteLine(p.DataTypeName);

However, this mechanism is problematic in various ways... Since the parameter isn't necessarily bound to an open connection, it can only take into account global type mappings. With the shift to data source mappings (#4494), this becomes more problematic.

We could have some sort of API on the data source itself that exposes the various mapping information.

Note: if we actually remove parameter inference, we can remove lots of messy support code (see everything on TypeHandlerResolverFactory). Though that would be a potentially bad breaking change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions