0
I’m having a hard time updating a record, using Ef. Relationship key conflict error. As if I’ve been trying to add and not update.
Additional information: A referential Integrity Constraint Violation occurred: The Property value(s) of 'Endereco.Enderecoid' on one end of a Relationship do not match the Property value(s) of 'Client.Enderecoid' on the other end.
public class Cliente
{
public Int64 ClienteId { get; set; }
public String Nome { get; set; }
public String Email { get; set; }
public String Cpf { get; set; }
public String Rg { get; set; }
public String TelFixo { get; set; }
public String Celular { get; set; }
public Int64 EnderecoId { get; set; }
public virtual Endereco Endereco { get; set; }
}
public class Endereco
{
public Int64 EnderecoId { get; set; }
public Int64 CidadeId { get; set; }
public Int64 EstadoId { get; set; }
public String Rua { get; set; }
public String Complemento { get; set; }
public String CEP { get; set; }
public String Bairro { get; set; }
public String Numero { get; set; }
public virtual Cidade Cidade { get; set; }
public virtual Estado Estado { get; set; }
public virtual ICollection<Cliente> ClienteList { get; set; }
}
Does an address have multiple customers? Does a customer belong to only one address? That’s right?
– Leonel Sanches da Silva
Gypsy, I took this relationship, I kept only the client and continued the mistake.
– Ricardo Soares