Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Speed up connection-specific mapping changes #2263
Npgsql allows users to change type mappings, either by plugins or manually. Changes can be done at two levels:
Changes to the connection-specific type mapper need to be restricted to the lifetime of the connection. That is, when a connection is returned to the pool, all changes must be reset, otherwise they will leak once the physical connection is returned again.
The current method for handling this checking whether any changes were done, and if so, disposing the entire type mapper and rebuilding mappings from scratch. This is a pretty heavy process that makes connection-based type mapping not very suitable for high-perf scenarios.
Instead, we could setup a sort of "undo list", tracking which mappings were changed and what needs to be done to reset them back.