c# – Umbraco:Node,DynamicNode,Content之间的差异

前端之家收集整理的这篇文章主要介绍了c# – Umbraco:Node,DynamicNode,Content之间的差异前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
然后有许多代表Umbraco文档的类:
1) umbraco.cms.businesslogic.Content
2) umbraco.cms.businesslogic.web.Document
3) umbraco.MacroEngines.DynamicNode
4) umbraco.presentation.nodeFactory.Node

还有其他人吗?

你能解释一下他们做了什么,何时使用它们?

umbraco.MacroEngines.DynamicNode和umbraco.presentation.nodeFactory.Node看起来是一样的.也许最好使用Node类,因为它更快?

我有一个理论:

umbraco.cms.businesslogic.Content和umbraco.cms.businesslogic.web.Document是cmsContent和cmsDocument数据库表的表示.

umbraco.presentation.nodeFactory.Node和umbraco.MacroEngines.DynamicNode表示在XML文件中缓存的节点,用于网站.
第一个是简单的Node,第二个是添加了动态属性的同一个Node,一个是nodeType中定义的属性.
所以,我认为Node比DynamicNode更快

有人可以证实吗?

解决方法

根据个人用途:

>内容:永远不要直接使用它,而是使用Document | Media | Member api(继承自此类).
>文档:用于创建|更新|删除操作.它直接对DB执行所有操作,因此只有在需要直接从db中获取值时才应该用于Read.
>节点:最常用:读取时|通过用户控件,代码库,xslt扩展等显示数据.
> DynamicNode:Razor宏.我还没有使用这个足以提供更多信息.

请参阅下面的更多详细信息,但不,Node和DynamicNode不相同(DynamicNode使用Examine,如果需要,还将回退到DB中读取).

umbraco.cms.businesslogic.Content:
Content is an intermediate layer between CMSNode and classes which will use generic data. Content is a datastructure that holds generic data defined in its corresponding ContentType. Content can in some sence be compared to a row in a database table,its ContentType holds a definition of the columns and the Content contains the data. Note that Content data in umbraco is not tabular but in a treestructure.

我从来没有必要直接使用这个类,因为它的所有操作都由相应的子类处理,例如:Document,Media,Member.这个类轮流继承自CMSNode,它是umbraco中每个内容数据的基类

umbraco.cms.businesslogic.web.Document:Document represents a webpage,published Documents are exposed to the runtime/the public website in a cached xml document.

从“内容部分”引用节点时使用此类.它处理CRUD操作.通过这个类,您还可以获得对每个属性的DataType的引用,以防您想要在aspx页面中呈现这些控件.

umbraco.NodeFactory.Node: It implements the INode interface which exposes read-only methods. All of its information comes from the umbraco cached xml. You will not get access to the controls of each property,rather the values of each formatted depending on the datatype.

您只能使用此类进行读取操作.由于所有内容都来自缓存(仅限已发布的节点),因此显示数据非常快.

umbraco.MacroEngines.DynamicNode: It was implemented to work with razor macros. It uses NodeFactory under the hood,which means it also access the cached xml. Although if you use the related DynamicMedia be careful as it uses: 1: ExamineIndex which strips out any html tags,2: it falls back to its default Media type (db if it isn’t in runtime cache) in umbraco_v4.11.5.

与上述相同.

猜你在找的C#相关文章