Sitecore 中 item.Axes.GetDescendants()
和 item.Axes.selectitems()
之间的基本/性能差异是什么?
item.Axes.GetDescendants()
使用 Sitecore API 获取item
的所有后代。它调用item.Children
,然后再次递归地child.Children
每个子项。它将所有这些项目添加到数组中。
item.Axes.Selectitems(string query)
执行在当前项目的上下文中在参数中传递的 Sitecore 查询。
所以这两种方法完全不同。
项。Axes.selectitems(( 根据提供的查询选择项目。使用项目总是好主意。Sitecore 中的 Axes.selectitems((而不是 GetDescendents,因为 Get Descendents 始终以递归方式获取子项,如果子项很大,则会对性能造成巨大影响。