I am trying to update a plugin from 4.2 to 4.4. Using the new ORM, how do I translate this entity framework code?
IQueryable<Order> query = GetExpandedOrderTable();
DateTime beginTime = settings.LastDownloadUtc;
DateTime endTime = settings.LastDownloadUtcEnd;
query = query.Where(a => a.CreatedOnUtc >= beginTime);
query = query.Where(a => a.CreatedOnUtc <= endTime);
List<int> storeIds = GetStoreIds();
if (storeIds.Count() > 0)
query = query.Where(a => storeIds.Contains(a.StoreId));
return new PagedList<Order>(query, 0, 1000).ToList();
/// <summary>
/// Expands order items and other sub properties.
/// Increases performance.
/// </summary>
/// <returns></returns>
private IQueryable<Order> GetExpandedOrderTable()
{
return orderRepository.Table
.Include(a => a.OrderItems)
.Include("OrderItems.Product")
.Include(a => a.OrderNotes)
.Include(a => a.GiftCardUsageHistory)
.Include(a => a.BillingAddress)
.Include(a => a.BillingAddress.StateProvince)
.Include(a => a.BillingAddress.Country)
.Include(a => a.ShippingAddress)
.Include(a => a.ShippingAddress.StateProvince)
.Include(a => a.ShippingAddress.Country)
.Include(a => a.Customer)
.Include(a => a.DiscountUsageHistory)
.Include(a => a.Shipments);
}
How do I get all of these objects?