- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
可以将任意数量的同一类的 ContentItems
添加到 N2 中的页面吗?它们可以嵌套吗?
即有没有办法将 ContentItems
的集合定义为 N2 中的属性?如果可能的话,我还想嵌套这些,以便我们可以对数据运行更有意义的查询。 (即,而不是使用难以查询的巨大 EditableTextRegions
。)
我目前有以下模型作为“理想”模型,它可以被 N2 化吗? (为清楚起见,我省略了属性和 N2 样式的 getter/setter)
public class Link : ContentItem
{
public string Text { get; set; }
public string Title { get; set; }
public string Url { get; set; }
}
public class Panel : ContentItem
{
public string Title { get; set; }
public string Text { get; set; }
public List<Link> Links { get; set; } // Should show an expandable number of “Link” editors in the CMS editor
public string ImageUrl { get; set; }
}
public class Page : ContentItem
{
public string Title { get; set; }
public string BodyText { get; set; }
public List<Panel> Panels { get; set; } // Should show an expandable number of “Panel” editors in the CMS editor
}
最佳答案
是的 - 在您的属性中使用 Get/SetDetailCollection 而不是 Get/SetDetail。
仅供引用,如果您使用的是 2.1,您可以将您的属性设置为 virtual
并取消 Get/SetDetail - 虽然不确定这是否适用于 DetailCollection 方法,但您可以将两者混合使用。
虽然我会小心你的建议 - 像这样嵌套集合可能会导致你 SELECT N+1下线的问题。如果您不能更改设计,那么我建议打开 N2 的数据库缓存(这只是 NHibernate 的二级缓存),这种方式将尽可能多地保留在内存中,而不会过多地访问数据库。
关于c# - N2 内容管理系统 : Are nested collections of ContentItems possible?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4657357/
我了解类层次结构和继承的基础知识。因此,我不理解 Watch 窗口为 ContentItem 对象显示的类层次结构。 似乎在说 ContentItem 继承 ContentItem 继承 Conten
以下 Qml 代码提供以下输出(预期): import QtQuick 2.7 import QtQuick.Controls 2.0 import QtQuick.Window 2.11 Windo
当我处于备用 View 时,我知道我可以使用以下方法获取 ContentItem 的显示 URL: @Url.ItemDisplayUrl(contentItem) 但我不知道如何在 Controll
我正在尝试使用以下代码更新特定部分: var nationalPart = _contentManager.Get(Id); nationalPart.Name = part.Name; 我
可以将任意数量的同一类的 ContentItems 添加到 N2 中的页面吗?它们可以嵌套吗? 即有没有办法将 ContentItems 的集合定义为 N2 中的属性?如果可能的话,我还想嵌套这些,以
我想知道 ListView 如何估计它的 contentItem 的高度/宽度,尽管委托(delegate)是一个 Component 而你不能问,大小可能因一个委托(delegate)实例而异。 它
我是一名优秀的程序员,十分优秀!