N2.Integrity error?

Topics: Developer Forum, Project Management Forum, User Forum
Aug 3, 2007 at 12: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")
N2.Integrity.AllowedChildren(typeof(BlogItem))
public class BlogContainer : MyItemBase {...}

N2.Integrity.AllowedParents(typeof(BlogContainer))
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??
Coordinator
Aug 3, 2007 at 2: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.

Regards,

/Cristian
Aug 4, 2007 at 10: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.

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

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