title: Dapper C#: A parameterless default constructor or one matching signature error
body: <p>I would like to get list of partitions for a given table.</p>
  <pre><code>public record Partition(string PartitionName, int OrdinalPosition);
  
  public class MysqlService
  {
      //...
  
      public IEnumerable&lt;Partition&gt; GetPartitions(string tableName)
      {
          using var conn = new MySqlConnection(_dbConnString);
          conn.Open();
          return conn.Query&lt;Partition&gt;(
              $&quot;SELECT PARTITION_NAME, PARTITION_ORDINAL_POSITION &quot; +
              $&quot;FROM information_schema.partitions WHERE TABLE_NAME = '{tableName}';&quot;);
      }
  }
  </code></pre>
  <p>But my code gives an error like</p>
  <pre><code>Unhandled exception. System.InvalidOperationException: A parameterless default constructor or one matching signature (System.String PARTITION_NAME, System.UInt64 PARTITION_ORDINAL_POSITION) is required for Services.Partition materialization
      at Dapper.SqlMapper.GenerateDeserializerFromMap(Type type, IDataReader reader, Int32 startBound, Int32 length, Boolean returnNullIfFirstMissing, ILGenerator il) in /_/Dapper/SqlMapper.cs:line 3297
      at Dapper.SqlMapper.GetTypeDeserializerImpl(Type type, IDataReader reader, Int32 startBound, Int32 length, Boolean returnNullIfFirstMissing) in /_/Dapper/SqlMapper.cs:line 3131
      at Dapper.SqlMapper.TypeDeserializerCache.GetReader(IDataReader reader, Int32 startBound, Int32 length, Boolean returnNullIfFirstMissing) in /_/Dapper/SqlMapper.TypeDeserializerCache.cs:line 151
      at Dapper.SqlMapper.TypeDeserializerCache.GetReader(Type type, IDataReader reader, Int32 startBound, Int32 length, Boolean returnNullIfFirstMissing) in /_/Dapper/SqlMapper.TypeDeserializerCache.cs:line 50
      at Dapper.SqlMapper.GetTypeDeserializer(Type type, IDataReader reader, Int32 startBound, Int32 length, Boolean returnNullIfFirstMissing) in /_/Dapper/SqlMapper.cs:line 3085
      at Dapper.SqlMapper.GetDeserializer(Type type, IDataReader reader, Int32 startBound, Int32 length, Boolean returnNullIfFirstMissing) in /_/Dapper/SqlMapper.cs:line 1835
      at Dapper.SqlMapper.QueryImpl[T](IDbConnection cnn, CommandDefinition command, Type effectiveType)+MoveNext() in /_/Dapper/SqlMapper.cs:line 1105
      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 734
      ...
  </code></pre>
  <p>How can I fix this?</p>
  <p>I tried to use <code>UInt64</code> instead of <code>int</code> for the type of <code>OrdinalPosition</code>, but the same error occured.</p>
  <p><strong>My Environment:</strong></p>
  <ul>
  <li>C# .NET Core Console Application (net6.0)</li>
  <li>Dapper 2.0.123</li>
  <li>MySQL 8.0</li>
  </ul>