0
Hello, I have a class with 2 keys composed
public class Produto_Empresa
{
[Key,Column(Order = 0)]
public int id_produto { get; set; }
[Key, Column(Order = 1)]
public int id_empresa { get; set; }
}
I wonder if it’s right I put it on the Product_company:
public virtual Produto produto { get; set; }
public class Produto
{
public int id { get; set; }
}
Or put public virtual ICollection<Produto_Empresa> ProdutoEmpresa { get; set; }
in the Product class.
Lack a context, you made a relationship many to many by the Product Company class, but,,,,,,,,,,, the question lacks more data and one remark: you have a composite key with 2 correct fields ?!
– novic
Yes, the Product_company has 2 primary keys, which is the product table and the company table
– Alysson bormann
You’re exactly doing what?
– novic
I want to know what the relationship looks like, within the classes, using 2 primary composite keys
– Alysson bormann
If you use any Orms?
– novic
to using the Entity Framework
– Alysson bormann
Let’s go continue this discussion in chat.
– novic