I'm new to Orchard, love it but I've got a small problem.
Background: I created a module in which I created Partner content type and PartnerPart. Partner content type is pretty "normal" type with PartnerPart, CommonPart etc - nothing fancy.
I need to display list of Partners in a widget so I created ListPartner with ListPartnerPart, and in ListPartnerPartDriver I just query IContentManager to get PartnerParts. This works OK.
But here's the problem - in details Partner view (where full Body is displayed) I also need to display "Other Partners" list, so this list must not contain the Partner that is currently visible. So I added ListPartnerPart to Partner type and in
ListPartnerPartDriver I have:
protected override DriverResult Display( ListPartnerPart part, string displayType, dynamic shapeHelper )
var parentContentItem = part.ContentItem;
int ignorePartnerId= -1;
if( part.ShowOtherThanContainerPartner && parentContentItem.ContentType == "Partner" )
// get list ignoring current partner
var partnersList = _partnerService.GetList( ignorePartnerId, currentCultureRecord, 0, part.Count, VersionOptions.Published );
var list = shapeHelper.List();
// here's the error:
list.AddRange( partnersList.Select( bp => _contentManager.BuildDisplay( bp, "Summary" ) ) );
return ContentShape( shapeHelper.Parts_Partner_List( ContentPart: part, ContentItems: list ) );
partnersList seems ok, but when building Summary (_contentManager.BuildDisplay) list with them, I get StackOverflow exception. I guess it's because PartnerPart is in Partner, and Partner has ListPartnerPart also, which gets rendered with Display method above
and so on...
Is there any way to fix it using parts or should I direct myself to using Controllers instead?
thanks in advance!