I am stuck with this error
Cannot insert the value NULL into column 'FuncionarioId', table 'aspnet-vet_plus-7C2DFFB7-3F35-42B0-88A6-094E42F60676.dbo.Endereco'; column does not allow nulls. UPDATE fails.
The statement has been terminated.
When I run the Update-Database
to update my columns.
This is my C# code in the Endereco - model
[Column("ClienteId")]
[Display(Name = "Cliente")]
[DisplayFormat(DataFormatString = "{0:N}", ApplyFormatInEditMode = true)]
public int ClienteId { get; set; }
[Column("FuncionarioId")]
[Display(Name = "Funcionário")]
[DisplayFormat(DataFormatString = "{0:N}", ApplyFormatInEditMode = true)]
public int FuncionarioId { get; set; }
public virtual Cliente Cliente { get; set; }
public virtual Funcionario Funcionario { get; set; }
I am trying to connect my Enderoco
database with the Cliente
and Funcionario
tables, the Enderoco table has to receive either a ClienteId or an FuncionarioId, it doesn't matter which one, but it must have one of the two.
Does anyone know about this error and how to fix it? Please, let me know!