Yes. You are right if it does multiple types - doesn't seem to be doing columns correctly in sql, although if you do for single type - it will work. i.e.
var text = DocumentHelper.GetDocuments("CMS.MenuItem")
//.Types(new string[] {"CMS.MenuItem", "CMS.BookingEvent"})
.Path("/Community/Events/", PathTypeEnum.Section)
.OnSite("CorporateSite")
.Columns(new string[] {"DocumentName", "NodeAliasPath"})
.Culture("en-us")
.GetFullQueryText();
Gives this:
DECLARE @NodeSiteID int = 2;
DECLARE @NodeAliasPath nvarchar(max) = N'/Community/Events/%';
DECLARE @NodeAliasPath1 nvarchar(max) = N'/Community/Events';
DECLARE @DocumentCulture nvarchar(max) = N'en-us';
SELECT [DocumentName], [NodeAliasPath], [ClassName], [DocumentCheckedOutVersionHistoryID]
FROM View_CMS_Tree_Joined AS V WITH (NOLOCK, NOEXPAND) INNER JOIN CONTENT_MenuItem AS C WITH (NOLOCK) ON [V].[DocumentForeignKeyValue] = [C].[MenuItemID] AND V.ClassName = N'CMS.MenuItem' LEFT OUTER JOIN COM_SKU AS S WITH (NOLOCK) ON [V].[NodeSKUID] = [S].[SKUID]
WHERE [NodeSiteID] = @NodeSiteID AND (([NodeAliasPath] LIKE @NodeAliasPath OR [NodeAliasPath] = @NodeAliasPath1) AND [DocumentCulture] = @DocumentCulture)
Although multiples types:
var queryText = DocumentHelper.GetDocuments()
.Types(new string[] {"CMS.MenuItem", "CMS.BookingEvent"})
.Path("/Community/Events/", PathTypeEnum.Section)
.OnSite("CorporateSite")
.Columns(new string[] {"DocumentName", "NodeAliasPath"})
.Culture("en-us")
.GetFullQueryText();
gives this:
DECLARE @NodeSiteID int = 2;
DECLARE @NodeAliasPath nvarchar(max) = N'/Community/Events/%';
DECLARE @NodeAliasPath1 nvarchar(max) = N'/Community/Events';
DECLARE @DocumentCulture nvarchar(max) = N'en-us';
SELECT *
FROM (
(
SELECT [MenuItemID], [MenuItemName], [MenuItemTeaserImage], [MenuItemGroup], NULL AS [BookingEventID], NULL AS [EventName], NULL AS [EventSummary], NULL AS [EventDetails], NULL AS [EventLocation], NULL AS [EventDate], NULL AS [EventEndDate], NULL AS [EventAllDay], NULL AS [EventCapacity], NULL AS [EventAllowRegistrationOverCapacity], NULL AS [EventOpenFrom], NULL AS [EventOpenTo], NULL AS [EventLogActivity], [DocumentName], [NodeAliasPath], ROW_NUMBER() OVER (ORDER BY DocumentName) AS [CMS_SRN], 0 AS [CMS_SN], 'cms.document.cms.menuitem' AS [CMS_T], [ClassName], [DocumentCheckedOutVersionHistoryID]
FROM View_CMS_Tree_Joined AS V WITH (NOLOCK, NOEXPAND) INNER JOIN CONTENT_MenuItem AS C WITH (NOLOCK) ON [V].[DocumentForeignKeyValue] = [C].[MenuItemID] AND V.ClassName = N'CMS.MenuItem' LEFT OUTER JOIN COM_SKU AS S WITH (NOLOCK) ON [V].[NodeSKUID] = [S].[SKUID]
WHERE [NodeSiteID] = @NodeSiteID AND (([NodeAliasPath] LIKE @NodeAliasPath OR [NodeAliasPath] = @NodeAliasPath1) AND [DocumentCulture] = @DocumentCulture)
)
UNION ALL
(
SELECT NULL AS [MenuItemID], NULL AS [MenuItemName], NULL AS [MenuItemTeaserImage], NULL AS [MenuItemGroup], [BookingEventID], [EventName], [EventSummary], [EventDetails], [EventLocation], [EventDate], [EventEndDate], [EventAllDay], [EventCapacity], [EventAllowRegistrationOverCapacity], [EventOpenFrom], [EventOpenTo], [EventLogActivity], [DocumentName], [NodeAliasPath], ROW_NUMBER() OVER (ORDER BY DocumentName) AS [CMS_SRN], 1 AS [CMS_SN], 'cms.document.cms.bookingevent' AS [CMS_T], [ClassName], [DocumentCheckedOutVersionHistoryID]
FROM View_CMS_Tree_Joined AS V WITH (NOLOCK, NOEXPAND) INNER JOIN CONTENT_BookingEvent AS C WITH (NOLOCK) ON [V].[DocumentForeignKeyValue] = [C].[BookingEventID] AND V.ClassName = N'CMS.BookingEvent' LEFT OUTER JOIN COM_SKU AS S WITH (NOLOCK) ON [V].[NodeSKUID] = [S].[SKUID]
WHERE [NodeSiteID] = @NodeSiteID AND (([NodeAliasPath] LIKE @NodeAliasPath OR [NodeAliasPath] = @NodeAliasPath1) AND [DocumentCulture] = @DocumentCulture)
)
) AS SubData
ORDER BY CMS_SRN, CMS_SN