I have the following class:
public class ParametrizacaoTolflux
{
public int CodigoModulo { get; set; }
public int CodigoSistema { get; set; }
public string Descricao { get; set; }
public int CodigoCategoria { get; set; }
}
I am performing the mapping according to the following class:
internal class ParametrizacaoTolflux_Mapping : EntityTypeConfiguration<ParametrizacaoTolflux>
{
public ParametrizacaoTolflux_Mapping()
{
this.ToTable("MR_PARAMETRIZACAO_TOLFLUX");
//this.HasKey(e => e...);
this.Property(t => t.CodigoModulo).HasColumnName("CODIGO_MODULO");
this.Property(t => t.CodigoSistema).HasColumnName("CODIGO_SISTEMA");
this.Property(t => t.Descricao).HasColumnName("DESCRICAO");
this.Property(t => t.CodigoCategoria).HasColumnName("CODIGO_CATEGORIA");
}
}
If I do not define an Id in the mapping generates the following error:
"One or more validation errors were detected during model generation: Amaggi.Tolflux.Dominio.DataAccess.ParametrizacaoTolflux: : EntityType 'ParameterizationTolflux' has no key defined. Define the key for this EntityType. \ r \ nPreparationTolfluxes: EntityType: EntitySet 'ParameterizationTolfluxes' is based on type 'ParameterizationTolflux' that has no keys defined. \ R \ n "
If I set an id in the table, class and mapping works normal.
But I do not want to have an Id for this table, would I have to ignore this Mapping Id to not generate this error?
Or have another way to get around this?