title: ASP.NET MVC Core 2. How avoid a component use the same model as the parent view?
body: <p>I'm creating a view component (filter component) which are invoked from a main view.</p>
  
  <p>the main view requires a list as a model</p>
  
  <pre><code>@model IEnumerable&lt;Filters&gt;
  </code></pre>
  
  <p>and on its header, its invokes the filters ViewComponent</p>
  
  <pre><code>&lt;vc:my-filter/&gt;
  </code></pre>
  
  <p>The <code>Default.cshtml</code> component view requires a <code>Filter</code> class</p>
  
  <pre><code>@model Filters
  </code></pre>
  
  <p>However when filter is <code>null</code> the component model receives the same model from the parent view. and the types are incompatible;</p>
  
  <blockquote>
    <p>InvalidOperationException: The model item passed into the ViewDataDictionary is of type 'Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1[Item]', but this ViewDataDictionary instance requires a model item of type 'Filters'.</p>
  </blockquote>
  
  <p>I rather not to pass an empty <code>new Filter()</code> to the ViewComponent view model cause the component has some null validations already implemented.</p>
  
  <p>I would like to <strong>do not send any model</strong> to the view component. How can I do it? I just don't want to it have access to the main page view model.</p>