N2 CMS: Are ContentItems Nested Collections Possible?

Can an arbitrary number of ContentItemsthe same class be added to a page in N2? And can they be nested?

those. Is there a way to define a collection ContentItemsas a property in N2? IDs also like to embed them, if possible, so that we can run more meaningful queries against the data. (For example, instead of a huge EditableTextRegionsone that will be difficult to request.)

Currently, I have the following model as "ideal", can it be N2ified? (Ive left N2 style attributes and getters / setters for clarity)

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
}
+3
source share
1 answer

Yes - instead of Get / SetDetail, use Get / SetDetailCollection in your properties.

FYI, 2.1, virtual Get/SetDetail - , DetailCollection, .

, , , , SELECT N + 1. , N2 ( NHibernate), , , , .

+4

Source: https://habr.com/ru/post/1784715/


All Articles