c# dapper error when parameter is list<int> No mapping exists from object type <>f__AnonymousType20`1[[System.Int32[]
<pre><code>string sqlQuery = "SELECT SellingPrice, MarkupPercent, MarkupAmount FROM ProfitMargins WHERE QuoteId in @QuoteId";
var profitMargin = await ctx.Database.SqlQuery&lt;dynamic&gt;(sqlQuery, 
    new { QuoteId = new[] { 1, 2, 3, 4, 5 } }
//String.Join(", ", QuoteIds.ToArray()))).ToListAsync();
</code></pre>

<p>can someone see what I am doing wrong?</p>

<blockquote>
  <p>No mapping exists from object type
  &lt;>f__AnonymousType20`1[[System.Int32[], mscorlib, Version=4.0.0.0,
  Culture=neutral, PublicKeyToken=]] to a known managed provider native
  type.</p>
</blockquote>

<p>I got this idea from this post: <a href="https://stackoverflow.com/questions/8388093/select-from-x-where-id-in-with-dapper-orm/" title="link">SELECT * FROM X WHERE id IN (…) with Dapper ORM</a> answered by: @LukeH</p>

<p><strong>UPDATE:</strong>  </p>

<p>I need it returned into a list .  see my whole function,  I've changed the code according to the answer posted by @JFM, but now cannot add <code>.ToListAsync</code></p>

<p>@JFM    </p>

<pre><code>public static async Task&lt;List&lt;dynamic&gt;&gt; GetProfitMargin(List&lt;int&gt; QuoteIds)
{
    using (var conn = new SqlConnection(new MYContext().Database.Connection.ConnectionString))
    {   
       string sqlQuery = "SELECT SellingPrice, MarkupPercent, MarkupAmount FROM ProfitMargins WHERE QuoteId in @QuoteId";
        {
            var profitMargin =  conn.Query&lt;dynamic&gt;(sqlQuery
               , new { QuoteId = new[] { 1, 2, 3, 4, 5 } }).ToListAsync());                    
        }
</code></pre>