title: Using IQueryable in onPost method
body: <p>In my .net-core project I'm trying to edit a list of data which I query from DB using LINQ.</p>
  
  <p>I can display this data in the table, no problem, but once I click "Submit" data, I get the following exception:</p>
  
  <p>"Model bound complex types must not be abstract or value types and must have a parameterless constructor."</p>
  
  <p>and my IQueryable is set to null</p>
  
  <p>So, I have a class, let say</p>
  
  <pre><code>class MyRecord
  {
    [Key]
    public int recordID {get; set;}
  
    public int recordType {get; set;}
  
    public String recordName {get; set;}
  }
  </code></pre>
  
  <p>then I create IQueryable list:</p>
  
  <pre><code>[BindProperty]
  public IQueryable&lt;MyRecord&gt; myRecordListQuery
  </code></pre>
  
  <p>and select from Database a list of records</p>
  
  <pre><code>myRecordListQuery = (from r in _context.RecordTable
                       where r.recordType == 0
                       select r);
  </code></pre>
  
  <p>so, up to here it works fine, I get my set of records and can work with them in the Razor Page (not MVC!), something like creating a HTML table and using my results in a form of:</p>
  
  <pre><code>&lt;td&gt;
  &lt;input asp-for="@Model.myRecordListQuery.Skip(i).First().recordName" class="form-control" /&gt;
  &lt;/td&gt;
  </code></pre>
  
  <p>So, records are correctly displayed and can be edited.</p>
  
  <p>The problem is, when I submit form, I get the exception written above...</p>
  
  <p>p.s. If I use List instead of IQueryable, it returns correct data on post method, but then it's not that ease to update a database - either I need to compare values (was / is) or update all records what is inefficient from my perspective.</p>
  
  <p>Would be thankful for any advise!</p>