Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(TypeHandler): use the custom type handler when packing a list parameter #2068

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tlecomte
Copy link

@tlecomte tlecomte commented Apr 3, 2024

Fixes #2067

The code for SqlMapper.PackListParameters was not using the custom type handler. This caused an error like No mapping exists from object type xxxxx to a known managed provider native type. when passing a collection parameter to a query, when the type of the collection items is not natively supported by the SQL client, and when a custom TypeHandler is registered for it.

Here this is fixed by using the same logic that is already in DynamicParameters.AddParameter.

A unit test is added to cover the scenario.

…ameter

Fixes DapperLib#2067

The code for `SqlMapper.PackListParameters` was not using the custom type handler. This caused an error like `No mapping exists from object type xxxxx to a known managed provider native type.` when passing a collection parameter to a query, when the type of the collection items is not natively supported by the SQL client, and when a custom `TypeHandler` is registered for it.

Here this is fixed by using the same logic that is already in `DynamicParameters.AddParameter`.

A unit test is added to cover the scenario.
@tlecomte
Copy link
Author

tlecomte commented Apr 3, 2024

Dear @mgravell, please see here a PR to fix an issue with list parameters and custom type handlers. Thank you very much for considering this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"No mapping exists" error when using a TypeHandler and a collection parameter
1 participant