我有一个表,其主键 id 是一个标识列。我认为当创建新记录时,id 将增加 1。
但是我在调试时发现它是0。为什么?
必要的代码:
public DbSet<testDetails> testDetailRecords { get; set; }
testDetails test = testContext.testDetailRecords.Create();
// test.id is 0 when hover over it
public class testDetails : IEntityWithRelationships
{
[Key]
[Required]
[Display(Name = "Primary Key", Description = "Primary Key")]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long id { get; set; }