Dapper not mapping bool to bit (as an input parameter) #1436
Comments
|
I don't understand the question. Dapper doesn't do injection of parameter values (exepct for a very specific case, which isn't this). Dapper simply adds parameters with typed values. There is no "resulting SQL" - Dapper literally doesn't have code to do anything like that! So: where did your "resulting SQL" come from? Is that some kind of trace? If so, I suspect that it was your ADO.NET provider that performed that step, possibly for a database that doesn't directly support parameters. Now the questions become:
|
|
@mgravell Thanks for the response. The resulting SQL is what gets translated and sent over the wire as the query string (since input parameters need to be mapped appropriately). I might have wrongfully assumed Dapper did this mapping (in this case turning bool false into Anyway, we're using Sql Server (running on Azure), and default ADO.NET provider for Sql (System.Data.SqlClient) - using .Net Core 2.2. Right now the obvious workaround is converting the bool value into an int... but not really sure why we would need to do that. |
|
I would be *very* surprised by SqlClient doing such a thing. If you have a
repro, that sounds like a bug to report to the SqlClient team.
…On Fri, 10 Apr 2020, 20:10 Jonny Ramos, ***@***.***> wrote:
@mgravell <https://github.com/mgravell> Thanks for the response.
The resulting SQL is what gets translated and sent over the wire as the
query string (since input parameters need to be mapped appropriately). I
might have wrongfully assumed Dapper did this mapping (in this case turning
bool false into False instead of 0).
Anyway, we're using Sql Server (running on Azure), and default ADO.NET
provider for Sql (System.Data.SqlClient) - using .Net Core 2.2.
Right now the obvious workaround is converting the bool value into an
int... but not really sure why we would need to do that.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1436 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAEHMAI244W5QVHIOAKK3DRL5VJLANCNFSM4MFA7I3Q>
.
|
|
It sounds like something else is going on here - can you provide full repro code? It sounds like your param is getting a |
Take this simple query for example:
Why is
falsemapping toFalse?Weirdly enough, it maps bit -> bool just fine.
The text was updated successfully, but these errors were encountered: