title: Make Entity Framework ignore Discriminator column
body: <p>I have a simple app with zero inheritance (at least as far as the database is concerned). How can I "tell" this to Entity Framework so that it would stop looking for the Discriminator column?</p>
  
  <p>I don't have access to change the structure of the database tables, but I need to change the data, and I can't do it because EF keeps trying to operate on the non-existent <code>Discriminator</code> column and crashing as a result.</p>
  
  <p><strong>Edit: Added code</strong></p>
  
  
  
  <pre class="lang-c# prettyprint-override"><code>public class DatabaseContext : DbContext {
      public DbSet&lt;User&gt; Users { get; set; }
  
      protected override void OnModelCreating(DbModelBuilder modelBuilder) {
          modelBuilder.Entity&lt;User&gt;().ToTable("Users");
      }
  }
  
  
  public class UserRepository {
      public int Insert(User entity) {
          using (var db = new DatabaseContext()) {
              var table = db.Users;
              table.Add(entity);
              return db.SaveChanges();
          }
      }
  }
  
  public class User : IEntity {
      public int Id { get; set; }
  
      public String Username { get; set; }
  
      public String Password { get; set; }
  
      public String FullName { get; set; }
  
      public String Email { get; set; }
  }
  
  public interface IEntity {
      int Id { get; set; }
  }
  </code></pre>