-
-
Notifications
You must be signed in to change notification settings - Fork 12
@p# collisions when more than 10 parameters #18
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
Comments
I didn't get it. Can you please provide a sample code to reproduce the problem? |
I came across the same issue as well; if you have following example:
it executes following sql:
with two |
Drizin
added a commit
that referenced
this issue
May 7, 2025
…with 0 elements after 10th element Previously we were naming arrays like @parray1, which Dapper expands to @parray11, @Parray12, @parray13, etc. However if there's another array at position 11 it would be named @parray11, and Dapper was supposed to expand it to @parray111, @parray112, etc. However if there are no elements it renders as @parray11, conflicting with the other array. Now arrays are named like @p1array, so there are no more conflicts.
Looks like this bug happens when Dapper expands an empty array. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ran into an issue today with this where the parameters being assigned were not getting incremented correctly inside of a CTE that also had a subquery in it using a list of parameters.
pseudocode example:
Just guessing at what the issue is here, but it looks like when array-based parameters are being created they're getting a created with the format of
@p<parameternumber><elementnumber>
, so if you have an array parameter that's first in the list @p11 will collide if you have more than 12 total parameters.Think the fix is in SqlParameterMapper.cs
(IsEnumerable(parameter.Argument) ? options.ParameterArrayNameSuffix : "")
should go to(IsEnumerable(parameter.Argument) ? $"{options.ParameterArrayNameSuffix}s" : "")
or something similar.The text was updated successfully, but these errors were encountered: