Code-First Entity Framework inserting data with custom ID
you can use the following attribute
[Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
on the key to your class or using fluentAPI
modelBuilder.Entity<Address>().Property(p => p.Id).HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
In EF Core you can use:
builder.Property(x => x.Id).ValueGeneratedNever();
or
[DatabaseGenerated(DatabaseGeneratedOption.None)]