2
I am using Entity Framework code first in C#, I have the following classes.
Procedure (only the relevant part):
public int Id { get; set; }
public virtual ICollection<Produto> Produtos { get; set; }
Products (only the relevant section):
public int Id { get; set; }
public virtual ICollection<Procedimento> Procedimentos { get; set; }
My business rule generates an n for n, with a little research I could see that the best way to solve this would be to create the virtual attributes Icollection<>
in both classes, my database was successfully generated but in both classes this field does not appear, in place was generated a tabelaprocedimentoproduto
that contains the fields(IdProduto
and IdProcedimento
), I can safely save inside this new table, however, I cannot recover the data to work, my context
does not identify this new table, I have tried to use include but was not successful.
Create a third class, it might even be that name ai, the process table, put the two inside it, and then map with hasmany(procedure). withmany(product)
– Lucas Miranda
could be a little clearer when mapping?
– Lucas Santos