I have the following catalog three:
When I call _relationRepository.GetParents<NodeRelation>(reference-to-shorts-category).ToList() I was expecting to get a reference to "Men" category since it's the parent and primary category of "Shorts", but it returns a reference to "Pyjama" which is an additional category. Is that correct? Am I doing anything wrong?
Thank you in advance!
You probably need to use IsPrimary like in the below code snippt
var nodeRelations = _relationRepository.GetParents<NodeEntryRelation>(entryContentReference).ToList();
var primaryRelation = nodeRelations.FirstOrDefault(x => x.IsPrimary);
if (primaryRelation != null)
var thisRelationContentReference = _referenceConverter.GetContentLink(primaryRelation.Parent.ID, CatalogContentType.CatalogNode, primaryRelation.Parent.WorkID);
var nodeContentBase = _contentLoader.Get<NodeContentBase>(thisRelationContentReference);