You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looks like Dapper doesn't support byte data type in the IN clause.
Microsoft.Data.SqlClient.SqlException (0x80131904): Incorrect syntax near '@Types'.
at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__195_0(Task`1 result)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
at Dapper.SqlMapper.QueryAsync[T](IDbConnection cnn, Type effectiveType, CommandDefinition command) in /_/Dapper/SqlMapper.Async.cs:line 434
at X.Resource.Database.DatabaseClient.<>c__DisplayClass89_0`1.<<ListAsync>b__0>d.MoveNext() in /media/ramdisk/Platform/Src/Resources/Database/DatabaseClient.cs:line 190
Steps to reproduce
SQL query
select*from
[Underwriting]
where
[LeadId] = @LeadId
and [Type] in @Types;
C# code
// Working versionasyncTask<IReadOnlyList<UnderwritingDataModel>>ListAsync(intleadId,int[]types){returnawaitListAsync<UnderwritingDataModel>(UseSql("ListUnderwritings"),new{ leadId, types });}// NOT working versionasyncTask<IReadOnlyList<UnderwritingDataModel>>ListAsync(intleadId,byte[]types){returnawaitListAsync<UnderwritingDataModel>(UseSql("ListUnderwritings"),new{ leadId, types });}
Dependencies
Dapper 2.1.37
Microsoft.Data.SqlClient 5.2.0
.NET 8.0.3
The text was updated successfully, but these errors were encountered:
mkorsukov
changed the title
Byte data type not supported in the IN clause
The byte data type is not supported by the IN clause
Apr 9, 2024
Intro
Looks like Dapper doesn't support
byte
data type in theIN
clause.Steps to reproduce
SQL query
C# code
Dependencies
2.1.37
5.2.0
8.0.3
The text was updated successfully, but these errors were encountered: