title: How to bind remaining query parameters to a dictionary in ASP.NET Core
body: <p>I'm using model binding for an ASP.NET Core application, and it has several known attributes configured, and then a dictionary where I want any additional URL attributes to be added. I want my query string to look like this:</p>
  
  <pre><code>/foobar?Id=5&amp;Status=pending&amp;SpecialKey=test
  </code></pre>
  
  <p>And for it to populate my model where the property <code>Id = 5, Status = Pending</code>, and to have a Dictionary called <code>ExtraParams</code> with one item, the key of "SpecialKey" and the value of "test".</p>
  
  <p>Here's my model now:</p>
  
  <pre><code>using Microsoft.AspNetCore.Http;
  using Newtonsoft.Json.Linq;
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Runtime.Serialization;
  using System.Text.Json.Serialization;
  
  namespace MyProject.Models
  {
      public class MyCustomModel
      {
          public string? Id { get; set; }
          public string? Status { get; set; }
          public string? SerialNumber { get; set; }
          public string? Nickname { get; set; }
          public string? DisplayName { get; set; }
  
          [JsonExtensionData]
          public Dictionary&lt;string, object&gt; ExtraParams { get; set; } = new Dictionary&lt;string, JToken&gt;();
      }
  }
  </code></pre>
  
  <p>As it stands now, only Id/Status get populated. The only way I can get anything in <code>ExtraParams</code> is by using the query string notation of <code>ExtraParams[key]=test</code> which I do not want.</p>