Entity Framework C# join with one column only from second table

  Kiến thức lập trình

I have a join in entity framework connecting the Order table and the OrderItem table. All Orders will have multiple OrderItems. I’m trying to return all the Orders, but only the orderItemStatus column from the OrderItem list.

In my Order model I have a property

public List<int>? orderItemStatus { get; set; }

I’m joining the 2 tables ok, but it’s returning all columns from the OrderItem.

orderList = await _context.Order.Include(orderItem => orderItem).ToListAsync();

How do I get a list of the Orders with just the OrderItem.orderItemStatus values?

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT