title: Cannot rename Discriminator column in Entity Framework 4.1 Code First database
body: <p>I have a model hierarchy configuration like so:</p>
  
  <pre><code>[Table("A")]
  abstract class A { }
  
  class B : A { } // treated as abstract
  
  [Table("C")]
  class C : B { }
  </code></pre>
  
  <p>This results in a TPH for A and B, and a TPT for C. So far this seems to work fine. There are two database tables being generated: "A" which contains both A and B model records, and "C" which contains only C model record columns not already kept in table "A".</p>
  
  <p>For the TPH arrangement on Table A, there is a generated "Discriminator" column, which EF CF creates on its own to distinguish type A vs type B. This column is fine and expected; however, I would like to <strong>rename it</strong>. For this post's sake, the new name might be "Type".</p>
  
  <p>The tutorials that document how to do this appear to suggest this:</p>
  
  <pre><code>modelBuilder.Entity&lt;A&gt;()
     .Map&lt;B&gt;(m=&gt;m.Requires("Type").HasValue(typeof(B).Name))
     .Map&lt;C&gt;(m=&gt;m.Requires("Type").HasValue(typeof(C).Name));
  </code></pre>
  
  <p>This does not seem to work, though, as I get a runtime error during database generation saying that the models of types A, B, and C are being added to the same table, and, "Mapping conditions can be used to distinguish the rows that these types are mapped to." (Whatever this means.)</p>
  
  <p>I also tried:</p>
  
  <pre><code>modelBuilder.Entity&lt;A&gt;()
      .Map&lt;B&gt;(m=&gt;m.Requires("Type"))
      .Map&lt;C&gt;(m=&gt;m.Requires("Type"));
  </code></pre>
  
  <p>.. as well as ..</p>
  
  <pre><code>modelBuilder.Entity&lt;A&gt;().Map(m=&gt;m.Requires("Type"));
  </code></pre>
  
  <p>.. and even though these attempts compile and produce no runtime errors, there seems to be no effect, as the Discriminator column remains as "Discriminator".</p>
  
  <p>I tried to create a new string property on A called "Discriminator", to which I was going to subsequently rename the property's column metadata, but that just gave me two "Discriminator" columns: "Discriminator" and "Discriminator1".</p>
  
  <p>Ideas?</p>