In my application a few times when I'm going to add some data to the database, the ID jumps to 1000 units.
I found some solutions, but they do not work for me because I use EF6 with code-first and my intention is to install the application with LocalDB on a machine without "programming components".
What would help me solve this?
Class example:
public class ProdutoDTO
{
public int produtoID { get; set; }
public int codigo { get; set; }
public string descricao { get; set; }
public decimal preco { get; set; }
public DateTime dataCadastro { get; set; }
}
Mapping:
class ProdutoConfig : EntityTypeConfiguration<ProdutoDTO>
{
public ProdutoConfig()
{
HasKey(p => p.produtoID);
Property(p => p.descricao)
.IsRequired()
.HasMaxLength(100);
Property(p => p.preco)
.IsRequired();
}
}
In the project I make use of: Code first, EF6, migrations, generic repositories, implementation repositories and mapping with Fluent Api.