i need to do this becasue i what to do more 'secondary' sorting in memory, but i cannot do this unless RelationInfo is not null.
What we're trying to accomplish is getting a collection of Entry objects and sort them after their Sort Order property. The RelationInfo property on the Entry objects is always null no mater what. Anybody experienced this before?
Cheers
Frederik
int count = 0;
var entries2 = CatalogContext.Current.FindItemsDto(catalogSearchParameters, catalogSearchOptions, ref count, catalogEntryResponseGroup);
if i use this code then i can get entries2.NodeEntryRelation[0].SortOrder, but i would like to get the same data without using Dto method call
I you are only trying to get the entries in order of the catalog node you could do the following.
CatalogRelationResponseGroup group = new CatalogRelationResponseGroup(CatalogRelationResponseGroup.ResponseGroup.NodeEntry); CatalogRelationDto relation = CatalogContext.Current.GetCatalogRelationDto(0, nodeId, 0, "", group); var entries = CatalogContext.Current.GetCatalogEntries(relation.NodeEntryRelation.AsEmuerable().Select(row => row.CatalogEntryId).ToArray());
You could also could convert the dto to an Entry[] by
entries2.CatalogEntry.AsEnumerable() .Select(row => new Entry(row)) .ToArray();
SortOrder is available here:
var relationInfos = entries2.NodeEntryRelation;
but after doing this:
var entries = entries2.CatalogEntry.AsEnumerable().Select(row => new Entry(row)).ToList();
entries has RealtionInfo null, i suposse becasue only catalogEntryRow is passed to constructor
but your idea got me to this solution:
var query = from entry in entries2.CatalogEntry.AsEnumerable()
join rel in entries2.NodeEntryRelation.AsEnumerable() on entry.CatalogEntryId equals rel.CatalogEntryId
select new Entry(entry) { RelationInfo = new RelationInfo { SortOrder = rel.SortOrder } };
so then i suppose answer to my question: if i can get RelationInfo without calling Dto method(just by calling FindItems) is 'false'
No, becasue you need the full dto to be able to populate the RelationInfo. Although if you put a repsonse group of relations or full it should pouplate the relation info. I will take a look at that and pass on to development.
Is strange the relationinfo is not populating when passing in the row constructor, as it looks to see if there is a RelationTypeId in the table. It does not matter that it passes just row in because it can get the related tables for the row as it does with Inventory etc. Anyway I will dig a little deeper and get back to you
in response i get multiple entries, but RelationInfo property is allways null.
Is that bug or im doing something wrong to get it?
PS. also tried different variations of CatalogEntryResponseGroup flags, did not help either