Open
Description
Bug Description
The 1.13 releases have broken DirectionalQueryField parameters (I reported this on Gitter a while ago but it got overlooked).
Exception Message:
System.ArgumentException
HResult=0x80070057
Message=No mapping exists from object type System.RuntimeType to a known managed provider native type.
Source=Microsoft.Data.SqlClient
StackTrace:
at Microsoft.Data.SqlClient.MetaType.GetMetaTypeFromValue(Type dataType, Object value, Boolean inferLen, Boolean streamAllowed)
at Microsoft.Data.SqlClient.MetaType.GetMetaTypeFromType(Type dataType)
at Microsoft.Data.SqlClient.SqlParameter.GetMetaTypeOnly()
at Microsoft.Data.SqlClient.SqlParameter.Validate(Int32 index, Boolean isCommandProc)
at Microsoft.Data.SqlClient.SqlCommand.SetUpRPCParameters(_SqlRPC rpc, Boolean inSchema, SqlParameterCollection parameters)
at Microsoft.Data.SqlClient.SqlCommand.BuildRPC(Boolean inSchema, SqlParameterCollection parameters, _SqlRPC& rpc)
at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean isAsync, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at Microsoft.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String method)
at Microsoft.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String methodName)
at Microsoft.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at RepoDb.DbConnectionExtension.ExecuteNonQueryInternal(IDbConnection connection, String commandText, Object param, Nullable`1 commandType, Nullable`1 commandTimeout, String traceKey, IDbTransaction transaction, ITrace trace, Type entityType, DbFieldCollection dbFields, Boolean skipCommandArrayParametersCheck)
at RepoDb.DbConnectionExtension.ExecuteNonQuery(IDbConnection connection, String commandText, Object param, Nullable`1 commandType, String traceKey, Nullable`1 commandTimeout, IDbTransaction transaction, ITrace trace)
at RepoDbTest.Program.Main(String[] args) in D:\Dev\Misc\Projects\RepoDbTest\Program.cs:line 23
Replicating
Just use your own documentation example code from here:
https://repodb.net/class/directionalqueryfield
Note there is a typo in those docs too of ParamDirection rather than ParameterDirection.
You don't even need database objects, the runtime error will happen as soon as it attempts to convert the QueryField array into sql parameters.
The same code will work fine with RepoDb 1.12.10 / 1RepoDb.SqlServer .1.5
Library Version:
RepoDb v1.13.1 and RepoDb.SqlServer v1.13.1