Skip to content

Commit 888dca0

Browse files
committed
Get ChildItems
1 parent 701a0e6 commit 888dca0

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/Services/Ordering/Ordering.API/Application/Sagas/OrderSaga.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
1+
using System.Linq;
42
using System.Threading.Tasks;
53
using Microsoft.EntityFrameworkCore;
64
using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.OrderAggregate;
@@ -20,10 +18,9 @@ public OrderSaga(OrderingContext orderingContext) : base(orderingContext)
2018
public override Order FindSagaById(int id)
2119
{
2220
var order = _orderingContext.Orders
23-
.Single(c => c.Id == id);
24-
25-
_orderingContext.Entry(order)
26-
.Member("OrderStatus");
21+
.Include(c => c.OrderStatus)
22+
.Include(c => c.OrderItems)
23+
.Single(c => c.Id == id);
2724

2825
return order;
2926
}

src/Services/Ordering/Ordering.Infrastructure/Repositories/OrderRepository.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ public Order Add(Order order)
3333

3434
public async Task<Order> GetAsync(int orderId)
3535
{
36-
return await _context.Orders.FindAsync(orderId);
36+
return await _context.Orders
37+
.Include(c => c.OrderStatus)
38+
.Include(c => c.OrderItems)
39+
.SingleAsync(c => c.Id == orderId);
3740
}
3841

3942
public void Update(Order order)

0 commit comments

Comments
 (0)