-
Notifications
You must be signed in to change notification settings - Fork 877
Description
Our current JSON support - both the older JSON.NET plugin and the newer System.Text.Json support introduced in #2306 - require you to manually specify NpgsqlDbType.{Json,Jsonb} on every parameter. In other words, it is currently not possible to map a user POCO type to json/jsonb at the global or connector level (the JSON.NET plugin exposes an API for this, but it does not actually work for over a single type).
This is because our type mapping currently doesn't support a situation where more than one CLR type is mapped to the same PostgreSQL type.
Note: it will not be possible to have the user POCO returned by default when reading (i.e. without explicitly specifying it in GetFieldValue), since there's no way for us to distinguish between incoming JSON documents coming back from the database.
Another reason we need to allow mapping at the type mapper level, is in order to allow the user to specify JSON serialization options.
This is very related (and could be a dup of) #2439.