【问题标题】:N2CMS: restricting the number of ContentItems of a certain type below another ContentItemN2CMS:限制某个类型的 ContentItem 数量低于另一个 ContentItem
【发布时间】:2013-01-25 16:10:12
【问题描述】:

我正在使用 N2CMS,并且我有两个继承自 ContentItem 的类 - 例如 HomePage 和 NewsPage。 NewsPage 设置为仅出现在 HomePage 下(使用 RestrictParents 属性):

[RestrictParents(typeof(HomePage))]

我是否可以在主页下方设置最大数量的新闻页面(在本例中为 1)?

【问题讨论】:

    标签: n2cms n2


    【解决方案1】:

    答案是你可以使用

    [RestrictCardinality] 
    

    属性。在我在问题中给出的示例中,您将使用

    [RestrictCardinality(ComparableType=typeof(NewsPart), MaximumCount=1)]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-27
      • 1970-01-01
      • 2015-05-17
      • 1970-01-01
      • 2014-07-11
      相关资源
      最近更新 更多