DapperAOT
DapperAOT copied to clipboard
feat: TypeHandler support
This PR represents an attempt to resolve issue #159.
The prior approach of the source generator (#117) inadvertently led to the generation of code that instantiated a new TypeHandler object for each parameter or column read operation (new global::CustomClassTypeHandler().Read(...)). This could lead to unnecessary object allocations and a minor performance overhead, especially in high-volume scenarios.
This PR introduces a TypeHandlerInstanceRegistry and modifies the code generation to ensure that:
- A single, static instance of each registered TypeHandler is created within the generated interceptor file (e.g.,
__Handler1,__Handler2). - All subsequent operations (setting parameters, parsing output parameters, reading result set columns) for a given type handler utilize this pre-allocated, static instance.