title: Query dynamic parameters. NotSupportedException
body: <p>I'm having small issue with using Dapper query parameters.</p>
  <p>I have:</p>
  <ul>
  <li>WebApi to receive request with all required data (entity name, columns, filters, etc). Filter in the deepest level has this structure (this model build from api model by ctor):</li>
  </ul>
  <pre class="lang-cs prettyprint-override"><code>    public class QueryFilterItem
      {
          public string Name { get; }
          public string FieldName { get; }
          public object Value { get; }
          public ComparisonType ComparisonType { get; }
      }
  </code></pre>
  <ul>
  <li>Query executor, which handles api call</li>
  </ul>
  <pre class="lang-cs prettyprint-override"><code>var arguments = new ExpandoObject();
  // ...
  arguments.TryAdd($&quot;{filter.Name}Entity{filter.FieldName}&quot;, filter.Value);
  // ... This part above is a part of another helper class, which is dynamically building filter query data
  
  IEnumerable&lt;dynamic&gt; result;
  
  using (var connection = DbConnectionFactory.CreateDbConnection())
  {
      result = connection.Query(sqlQuery, arguments); // tried with wrapping into DynamicParameters
  }
  </code></pre>
  <p>And from that code, I get this exception:</p>
  <pre><code>System.NotSupportedException: The member MyFilterItemEntityId 
  of type System.Text.Json.JsonElement cannot be used as a parameter value
     at Dapper.SqlMapper.LookupDbType(Type type, String name, Boolean demand, ITypeHandler&amp; handler) in /_/Dapper/SqlMapper.cs:line 418
     at Dapper.DynamicParameters.AddParameters(IDbCommand command, Identity identity) in /_/Dapper/DynamicParameters.cs:line 232
     at Dapper.DynamicParameters.Dapper.SqlMapper.IDynamicParameters.AddParameters(IDbCommand command, Identity identity) in /_/Dapper/DynamicParameters.cs:line 151
     at Dapper.SqlMapper.&lt;&gt;c__DisplayClass165_0.&lt;GetCacheInfo&gt;b__0(IDbCommand cmd, Object obj) in /_/Dapper/SqlMapper.cs:line 1714
     at Dapper.CommandDefinition.SetupCommand(IDbConnection cnn, Action`2 paramReader) in /_/Dapper/CommandDefinition.cs:line 129
     at Dapper.SqlMapper.&lt;QueryImpl&gt;d__140`1.MoveNext() in /_/Dapper/SqlMapper.cs:line 1080
     at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
     at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
     at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 725
     at Dapper.SqlMapper.Query(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in /_/Dapper/SqlMapper.cs:line 652
     at DappertStorageTest.Cqrs.SelectQueryHandler.GetByFilters(SelectQuery query)
     at DappertStorageTest.Cqrs.SelectQueryHandler.Handle(SelectQuery query)
     at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
     at MAS.DappertStorageTest.Cqrs.Infrastructure.QueryProcessor.Execute[TResult](IQuery`1 query)
     at MAS.DapperStorageTest.Controllers.DataController.Select(SelectRequest selectRequest)
     at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
     at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
     at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.&lt;&lt;InvokeActionMethodAsync&gt;g__Logged|12_1&gt;d.MoveNext()
  </code></pre>
  <blockquote>
  <p>Arguments values (not part of exception):</p>
  <p>sqlQuery: USE [DapperStorageTest];SELECT * FROM [Passenger] WHERE ([Id] = @MyFilterItemEntityId)</p>
  <p>Arguments: {[MyFilterItemEntityId, ValueKind = String : &quot;7d570abd-576d-425f-9d24-d84314d299ba&quot;]} (raw)</p>
  </blockquote>
  <p>Can someone help me with that?</p>