Answer the question
In order to leave comments, you need to log in
How to make a selection, (many to many)?
Hello, I have a table (many to many) it has fields:
var ids = from prd in context.Positions.Where(p => p.order_id == order_id)
select new
{
prd.product_id
};
var products = from prd in context.Products
where ids.Contains(prd.id)
select prd;
Answer the question
In order to leave comments, you need to log in
no need to perform 2 separate requests here, everything can be obtained with one
var products = from p in context.Products
join o in context.Orders on p.Order_Id equals o.Id
where o.Id == <НОМЕР ЗАКАЗА>
select p;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question