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?
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 Discriminator
column and crashing as a result.
Edit: Added code
public class DatabaseContext : DbContext {
public DbSet<User> Users { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder) {
modelBuilder.Entity<User>().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; }
}