This project is read-only.

N2.Integrity error?

Topics: Developer Forum, Project Management Forum, User Forum
Aug 3, 2007 at 1:52 PM
Have a problem with the N2.Integrity.AllowdParents and N2.Integrity.AllowedChildren attributes.

My simple example is as follows:
I want to create a BlogContainer parent with several BlogItem children.
The BlogContainer should only contain BlogItems and
the BlogItem should only have a BlogContainer as parent.

I'v tried the following:

N2.Item("Blog container", "BlogContainer")
public class BlogContainer : MyItemBase {...}

N2.Item("Blog item", "BlogItem")
public class BlogItem : MyItemBase {...}

The problem is that I'm still able to add other page types to the BlogContainer. (I only want BlogItem in the edit list)

Anyone who could share some light??
Aug 3, 2007 at 3:24 PM

I realise that the attribute naming makes this confusing. Maybe I should change this.

This is how it works:
  • AllowedParents restricts which parents an item may have unless that parent specifically allows the item.
  • AllowedChildren adds to the children that would be allowed.

Basically, what you've done, is allowing the blog item below the container from both sides. The solution lies in the other classes in your solution. If they implement AllowedParents the problem should be solved.


Aug 4, 2007 at 11:54 AM
Thanks for the quick response.
So the main attribute to use is AllowedParents.. If this is set for every type in my solution then I'll get what I want.

It probably was the naming that threw me off :-)

Anyway.. Keep up the good work. You have created an awesome product..
I was very pleased when I found this cms after looking for a simple and flexible solution for my site.

Aug 4, 2007 at 5:34 PM
Thank you =) and don't be afraid to point out other inconsistencies.

Aug 4, 2007 at 5:35 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.