Map a table and enable Auto-increment of an FK field in PostGre using EF Core and Fluent Api

0

I can not activate the Auto_Increment of the ContactIdId field in PostGre. In the table mapping I have specified the "ValueGeneratedOnAdd" feature, but when I update the database with Migrations, nothing changes. When I try to insert a record in the Application it gives error because the field is not being incremented. Does anyone know how to help me?

A hug to everyone!

public class ContactTipoMap: IEntityTypeConfiguration     {         public void Configure (EntityTypeBuilder builder)         {             builder.ToTable ("ContactType");

        builder.HasKey(ct => new { ct.Id });

        builder.Property(ct => ct.Id)
             .ValueGeneratedOnAdd()
            .IsRequired();

        builder.Property(ct => ct.Id)
            .HasColumnName("ContatoTipoId")
            .HasColumnType("integer")
            .IsRequired();

        builder.Property(ct => ct.Descricao)
           .HasColumnName("Descricao")
           .HasColumnType("character varying(50)")
           .IsRequired();

        builder.Property(ct => ct.PadraoSistema)
          .HasColumnName("PadraoSistema")
          .HasColumnType("boolean");

    }
}

    
asked by anonymous 23.08.2018 / 13:09

0 answers