public void Get_Includes() { var context = TestEntities.Create(); var q = context.Orders .Include(o => o.OrderDetails.Select(od => od.Product.Supplier.Addresses.Select(a => a.City))) #if NET_CORE .Include(o => o.OrderDetails).ThenInclude(od => od.Select(x => x.Product)).ThenInclude(p => p.Supplier).ThenInclude(c => c.MainAddress);
public void Get_Includes() { var context = TestEntities.Create(); var q = context.Orders .Include(o => o.OrderDetails.Select(od => od.Product.Supplier.Addresses.Select(a => a.City))) .Include(o => o.OrderDetails.Select(od => od.Product.Supplier.MainAddress)); var oIncludes = Helper.GetIncludes(q).FirstOrDefault(); Assert.True(oIncludes != null && oIncludes.Member == "OrderDetails"); var odInclude = oIncludes.Children.FirstOrDefault(); Assert.True(odInclude != null && odInclude.Member == "Product"); var pInclude = odInclude.Children.FirstOrDefault(); Assert.True(pInclude != null && pInclude.Member == "Supplier"); Assert.Equal(pInclude.Children.Count(), 2); }