Is there any way we can get the underlying "many to many table" joining the two entities in entity framework.
For example if we have Product and Order entities, how can we get the underlying conjunction table Product_Order that joins the Product and Order table.
Any help would be appreciated.
It is possible to expose junction table as an entity but it is not common / needed:
Product
and Order
entitiesProductOrder
entity in designer (either by using toolbox or context menu)ProductId
, OrderId
- make sure that both are marked as entity key (they must be composite primary key in the database) and have the same type as PKs Product
and ProductOrder
and the second between Order
and ProductOrder
.There is very big chance that if you need this you are doing something wrong.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With