title: Add discriminator column as a part of a unique index in Entity Framework
body: <p>Is it possible using EF Fluent API to configure a Discriminator column and another string column to be part of a unique index constraint?</p>
  
  <p>I have a list of identifiers, where the identifiers can be of different types. Each identifier has a property of type string which holds the identifying string.</p>
  
  <p>A customer in my case can ha different identifiers. But there can only be one identifier with unique string per discriminator.</p>
  
  <p>Abstract class defining a identifier type</p>
  
  <pre><code> public abstract class CustomerIdentifier : Entity&lt;int&gt;
   {
      public string Identifier { get; set; }
   }
  </code></pre>
  
  <p>Concrete class derived from CustomerIdentifier</p>
  
  <pre><code> class NationalIdNumberIdentifier : CustomerIdentifier
   {
   }
  </code></pre>
  
  <p>I've managed to configure index for the string column using the answer here,
  <a href="https://stackoverflow.com/questions/18889218/unique-key-constraints-for-multiple-columns-in-entity-framework">Unique Key constraints for multiple columns in Entity Framework</a> as follows</p>
  
  <pre><code>class CustomerIdentifierMap : EntityTypeConfiguration&lt;CustomerIdentifier&gt;
  {
      public CustomerIdentifierMap()
      {
          Property(p =&gt; p.Identifier).HasMaxLength(100).IsRequired().HasUniqueIndexAnnotation("UQ_IdentifierPerDiscriminator", 0);
      }
  }
  </code></pre>
  
  <p>I need to somehow add another line here specifiying that the discrimnator should be included in the unique index constraint.</p>