Umbraco - 在 C# 中查找根节点 [英] Umbraco - Finding Root Node in C#

查看:27
本文介绍了Umbraco - 在 C# 中查找根节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究后端模块,所以 Node.GetCurrent() 不是一个选项.我需要找到一种方法来调用类似 Node currentNode = new Node(parentNodeId); 并获取站点的根节点的方法.我在 XSLT 中看到过示例,但没有看到 C# 中的示例.有谁知道我如何才能做到这一点?

I'm working on a backend module, so Node.GetCurrent() is not an option. I need to find a way to call something like Node currentNode = new Node(parentNodeId); and get the root node of the site. I've seen samples in XSLT, but nothing for C#. Does anyone know how I can accomplish this?

即使只是获取根节点的 ID 以便我可以调用 new Node() 也会很棒.

Even just getting the ID of the root node so I can call new Node() would be great.

推荐答案

根节点始终可用:

var rootNode = new Node(-1);

这篇关于Umbraco - 在 C# 中查找根节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆