EF6 DbModelBuilder
protected override void OnModelCreating(DbModelBuilder modelBuilder) { modelBuilder.Entity<Product>().HasKey(t => t.ProductID); modelBuilder.Entity<Product>().Property(t => t.ProductID) .HasColumnName("ProductID") .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None); }