3

I'm using N2CMS, and I have two classes that inherit from ContentItem - say HomePage and NewsPage. NewsPage is set to only appear under HomePage (using the RestrictParents attribute):

[RestrictParents(typeof(HomePage))]

Can I make it so there is a maximum number of NewsPages (in this case 1) below the home page?

Tom Bull
  • 1,189
  • 13
  • 17

1 Answers1

3

The answer is that you can use the

[RestrictCardinality] 

attribute. In the example I gave in the question, you would use

[RestrictCardinality(ComparableType=typeof(NewsPart), MaximumCount=1)]
Tom Bull
  • 1,189
  • 13
  • 17