2
If I’m not mistaken, this must have come in version 6.1.1 of Entityframework and it wasn’t like this in previous versions.
I believe a column only became auto-increment when the attribute DatabaseGenerated
was declared with the signature [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
.
I have a simple class, like this:
public class Municipio
{
[Key]
public int Id { get; set; }
[StringLength(50)]
[Required(AllowEmptyStrings = false)]
public string Descricao { get; set; }
[StringLength(2)]
[Required(AllowEmptyStrings = false)]
public string Uf { get; set; }
}
See that property Id
is declared with the attribute KeyAttribute
only. However, a column is being generated Autoincrement.
How to stop it from happening?