I have 3 models
public class UnidadeNegocio
{
public int Id { get; set; }
public string Nome { get; set; }
}
public class Cliente
{
public int Id { get; set; }
public int UnidadeNegocioId { get; set; }
public string Nome { get; set;}
}
public class Venda
{
public int Id { get; set; }
public int ClienteId { get; set; }
public int UnidadeNegocioId { get; set; }
public float Valor{ get; set; }
}
I need to ensure that in the Sales and Sales table, both contain the same Business Unit ID. That is, they must be equal.
In Sql server, we created compound key
How could I create and resolve this problem using Fluent Api
of Entity Framework?