title: Regarding Discriminator in EF Core, is there a way to set the base class with all values?
body: <p>I want that when retrieving the base class I should get all rows in the table disregarding the discriminator. I only want to use the discriminator when retrieving one of the derived classes. How can I accomplish that?</p>
  
  <p>The first thing that I tried was to only set HasValue for the derived classes but not the base class like this...</p>
  
  <pre><code>modelBuilder.Entity&lt;BaseClass&gt;(entity =&gt;
  {
     entity.HasDiscriminator(e =&gt; e.DiscriminatorProperty)
       // .HasValue&lt;BaseClass&gt;()
       .HasValue&lt;DerivedClass1&gt;(1)
       .HasValue&lt;DerivedClass2&gt;(2);
  });
  </code></pre>
  
  <p>...but that gives me the following error:</p>
  
  <blockquote>
    <p>An exception of type 'System.InvalidOperationException' occurred in System.Private.CoreLib.dll but was not handled in user code:
    'The entity type 'BaseClass' is part of a hierarchy, but does not have a discriminator value configured.'</p>
  </blockquote>
  
  <p>Another thing that I tried was to configure the BaseClass for each possible discriminator value like this...</p>
  
  <pre><code>modelBuilder.Entity&lt;BaseClass&gt;(entity =&gt;
  {
     entity.HasDiscriminator(e =&gt; e.DiscriminatorProperty)
       .HasValue&lt;BaseClass&gt;(1)
       .HasValue&lt;BaseClass&gt;(2)
       .HasValue&lt;DerivedClass1&gt;(1)
       .HasValue&lt;DerivedClass2&gt;(2);
  });
  </code></pre>
  
  <p>...but when actually trying to retrieve the base class, I only got records with discriminator value of 1. EF Core seemed to only recognize the first configuration and ignore the next.</p>
  
  <p>So my question is how can I configure the discriminator specifically for the derived classes but not for the base class? In other words when retrieving the base class I should get all of the records in the table.</p>