title: No access to properties from derived class in razor pages
body: <p>Why can't i access property from the subclass? I hope i don't have to create separate variables for every of subclass in order to get data from.</p>
  <p>My base class:</p>
  <pre><code> public class BookModel
  {
      public int ID { get; set; }
      public string Type { get; set; }
      public string Tittle { get; set; }
      public string? Author { get; set; }
      public string? Genre { get; set; }
      public int? Pages { get; set; }
      public bool Lent { get; set; }
  
      [DisplayFormat(ApplyFormatInEditMode = true)]
      public DateTime? LoanDateTimeStart { get; set; }
      [DisplayFormat(ApplyFormatInEditMode = true)]
      public DateTime? LoanDateTimeEnd { get; set; }
  
      [ForeignKey(nameof(User))]
      public int? UserId { get; set; }
      public UserModel? User { get; set; }
  
  }
  </code></pre>
  <p>Derived class:</p>
  <pre><code> public class MovieModel : BookModel
  {
      [Column(&quot;Length(min)&quot;)]
      public int? Length { get; set; }
      public string? Director { get; set; }
  
  }
  </code></pre>
  <p>Then my htmlcs:</p>
  <pre><code>  public class SearchModel : PageModel
  {
      [BindProperty(SupportsGet = true)] public string? SearchKey { get; set; } = string.Empty;
  
      public List&lt;BookModel&gt; AllObjects { get; set; } = new List&lt;BookModel&gt;();
      public ApiManager? apiManager { get; set; }
  
      public async Task OnGet()
      {
  
          if (string.IsNullOrEmpty(SearchKey))
          {
              apiManager = new();
              AllObjects = await apiManager.GetAllObjects();
             // return all or null
  
          }
          else
          {
              // var allObjects = await apiManager.ReturnAllObjects();
              // Objects = allObjects.Where(x =&gt; x.Name.Contains(SearchKey, StringComparison.CurrentCultureIgnoreCase)).ToList();
          }
      }
  }
  </code></pre>
  <p>and finally how it looks like in cshtml page with <a href="https://i.stack.imgur.com/EzFkp.png" rel="nofollow noreferrer">red underscore</a></p>