Skip to content

Commit d381740

Browse files
committed
Include missing entities in GetAllAsQueryable for paginated data retrieval
1 parent 7b139c8 commit d381740

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

NorthwindCRUD/Services/CustomerService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ public CustomerDb[] GetAll()
2222

2323
public IQueryable<CustomerDb> GetAllAsQueryable()
2424
{
25-
return this.dataContext.Customers;
25+
return this.dataContext.Customers
26+
.Include(c => c.Address);
2627
}
2728

2829
public CustomerDb? GetById(string id)

NorthwindCRUD/Services/EmployeeService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ public EmployeeDb[] GetAll()
2222

2323
public IQueryable<EmployeeDb> GetAllAsQueryable()
2424
{
25-
return this.dataContext.Employees;
25+
return this.dataContext.Employees
26+
.Include(c => c.Address);
2627
}
2728

2829
public EmployeeDb? GetById(int id)

NorthwindCRUD/Services/OrderService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ public OrderDb[] GetAll()
2525

2626
public IQueryable<OrderDb> GetAllAsQueryable()
2727
{
28-
return this.dataContext.Orders;
28+
return this.dataContext.Orders
29+
.Include(c => c.ShipAddress);
2930
}
3031

3132
public OrderDb[] GetNOrders(int numberOfOrdersToRetrieve)

0 commit comments

Comments
 (0)