Heya Dalton,
Brenden is correct here. How that would look is slightly tricky.
Usually you can just do a join on the DataQuery with DataQuery.Source(source => source.LeftJoin("CMS_Tree.ClassName", "CMS_Class.ClassName"));
But doing joins with DocumentQuery
are a bit of a pain cause regardless of what columns you set, kentico will always inlcude system columns like DocumentId, ClassName, etc
& if you try to join CMS_Class
like above, you'll get an ambigious column error on the ClassName column, on a column you dont even add, so you cant even fully qualify it.
Instead, I'd reccommend approaching it from the other direction - and have a preliminary query to retrieve all the relevant class names & include it as an additional where condition on the page query, so something like:
var relevantPageTypeClassNames = DataClassInfoProvider.GetClasses()
.WhereTrue(nameof(DataClassInfo.ClassIsNavigationItem))
//.WhereTrue(nameof(DataClassInfo.ClassHasMetadata))
//.WhereTrue(nameof(DataClassInfo.ClassUsesPageBuilder))
//.WhereTrue(nameof(DataClassInfo.ClassHasURL))
.AsSingleColumn(nameof(DataClassInfo.ClassName));
pageRetriever.RetrieveMultiple(query =>
{
//query.Where(...) //Your existing query
query.WhereIn(nameof(TreeNode.ClassName), relevantPageTypeClassNames);
});