This (northwind in LINQPad, adapter)
from p in Product.IncludeFields(p=>p.ProductName).WithPath(p1=>p1.Prefetch(p=>p.Category))
select p
produces this
SELECT [LPA_L1].[CategoryID] AS [CategoryId],
[LPA_L1].[ProductID] AS [ProductId],
[LPA_L1].[ProductName],
[LPA_L1].[SupplierID] AS [SupplierId]
FROM
[dbo].[Products] [LPA_L1]
DECLARE @p1 Int; SET @p1=6
DECLARE @p2 Int; SET @p2=2
DECLARE @p3 Int; SET @p3=7
DECLARE @p4 Int; SET @p4=4
DECLARE @p5 Int; SET @p5=8
DECLARE @p6 Int; SET @p6=1
DECLARE @p7 Int; SET @p7=5
DECLARE @p8 Int; SET @p8=3
SELECT [dbo].[Categories].[CategoryID] AS [CategoryId],
[dbo].[Categories].[CategoryName],
[dbo].[Categories].[Description],
[dbo].[Categories].[Picture]
FROM
[dbo].[Categories]
WHERE
( [dbo].[Categories].[CategoryID] IN (@p1,
@p2,
@p3,
@p4,
@p5,
@p6,
@p7,
@p8))
but this
from p in Product.IncludeFields(p=>p.ProductName).WithPath(p1=>p1.Prefetch(p=>p.Category))
select new {p}
produces
SELECT [LPLA_1].[CategoryID] AS [CategoryId],
[LPLA_1].[Discontinued],
[LPLA_1].[ProductID] AS [ProductId],
[LPLA_1].[ProductName],
[LPLA_1].[QuantityPerUnit],
[LPLA_1].[ReorderLevel],
[LPLA_1].[SupplierID] AS [SupplierId],
[LPLA_1].[UnitPrice],
[LPLA_1].[UnitsInStock],
[LPLA_1].[UnitsOnOrder]
FROM
[dbo].[Products] [LPLA_1]
No include fields, no prefetch - why is that?
SD.LLBLGen.Pro.LinqSupportClasses.NET35.dll version 3.5.12.0807
SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll version 3.5.12.0824