Reproduced (LinqSupportClasses RTL = 2.6.8.814)
Using Lambda Expressions (generated ORDER BY is missing)
var q = (from c in metaData.Customers
where c.CustomerId == "ALFKI"
select c)
.WithPath(customerPath =>
customerPath.Prefetch<OrdersEntity>(c => c.Orders).OrderBy(o => o.Freight).LimitTo(2));
List<CustomersEntity> customers = q.ToList();
Generated SQL
SELECT
[Northwind].[dbo].[Orders].[OrderID] AS [OrderId],
[Northwind].[dbo].[Orders].[CustomerID] AS [CustomerId],
[Northwind].[dbo].[Orders].[EmployeeID] AS [EmployeeId],
[Northwind].[dbo].[Orders].[OrderDate],
[Northwind].[dbo].[Orders].[RequiredDate],
[Northwind].[dbo].[Orders].[ShippedDate], [Northwind].[dbo].[Orders].[ShipVia],
[Northwind].[dbo].[Orders].[Freight], [Northwind].[dbo].[Orders].[ShipName],
[Northwind].[dbo].[Orders].[ShipAddress],
[Northwind].[dbo].[Orders].[ShipCity], [Northwind].[dbo].[Orders].[ShipRegion],
[Northwind].[dbo].[Orders].[ShipPostalCode],
[Northwind].[dbo].[Orders].[ShipCountry] FROM [Northwind].[dbo].[Orders]
WHERE ( ( ( [Northwind].[dbo].[Orders].[CustomerID] = @CustomerId1)))
Using WithPath and PathEdges
LinqMetaData metaData = new LinqMetaData(adapter);
var q = (from c in metaData.Customers
where c.CustomerId == "ALFKI"
select c)
.WithPath(new PathEdge<OrdersEntity>(CustomersEntity.PrefetchPathOrders, null,
new SortExpression((OrdersFields.Freight | SortOperator.Ascending)), 0));
List<CustomersEntity> customers = q.ToList();
Generated SQL
SELECT
[Northwind].[dbo].[Orders].[OrderID] AS [OrderId],
[Northwind].[dbo].[Orders].[CustomerID] AS [CustomerId],
[Northwind].[dbo].[Orders].[EmployeeID] AS [EmployeeId],
[Northwind].[dbo].[Orders].[OrderDate],
[Northwind].[dbo].[Orders].[RequiredDate],
[Northwind].[dbo].[Orders].[ShippedDate], [Northwind].[dbo].[Orders].[ShipVia],
[Northwind].[dbo].[Orders].[Freight], [Northwind].[dbo].[Orders].[ShipName],
[Northwind].[dbo].[Orders].[ShipAddress],
[Northwind].[dbo].[Orders].[ShipCity], [Northwind].[dbo].[Orders].[ShipRegion],
[Northwind].[dbo].[Orders].[ShipPostalCode],
[Northwind].[dbo].[Orders].[ShipCountry] FROM [Northwind].[dbo].[Orders]
WHERE ( ( ( [Northwind].[dbo].[Orders].[CustomerID] = @CustomerId1)))
ORDER BY [Northwind].[dbo].[Orders].[Freight] DESC
In the meantime please use the PathEdges workaround. We will look into it.