I have a sql statement with a CASE WHEN command that returns 0 or 1. When I tried to execute the query filling my entity object, it always had the boolean property set to false. So I tried to change the data type of my property to integer, and it always returns 0, even when the query returned the correct values on SQL Server.
Here is the snippet:
CAST(CASE WHEN Partner.ID IS NULL THEN 0
ELSE 1 END AS BIT) AS Associated
Can you help me?
Thanks
The short answer here is that dapper has no knowledge whatsoever about the TSQL (except for the custom "in @too" syntax it parses) and should as a result be fine with any valid TSQL. All it sees is the grids that come back. What you show should work fine as long as the property and column names match. If it isn't working, I'll have to try a test case later today - but it looks very similar to some code I use. Again: yes, that should be fine.