public void Deserialize(IPrimitiveReader reader, int version) { //MultiIndexContainsQueryResultItemIndexHeaderList ushort count = reader.ReadUInt16(); if (count > 0) { MultiIndexContainsQueryResultItemIndexHeaderList = new List <Pair <MultiIndexContainsQueryResultItem, IndexHeader> >(count); MultiIndexContainsQueryResultItem multiIndexContainsQueryResultItem; IndexHeader indexHeader; for (ushort i = 0; i < count; i++) { multiIndexContainsQueryResultItem = null; indexHeader = null; //MultiIndexContainsQueryResultItem if (reader.ReadBoolean()) { multiIndexContainsQueryResultItem = new MultiIndexContainsQueryResultItem(); Serializer.Deserialize(reader.BaseStream, multiIndexContainsQueryResultItem); } //IndexHeader if (reader.ReadBoolean()) { indexHeader = new IndexHeader(); Serializer.Deserialize(reader.BaseStream, indexHeader); } MultiIndexContainsQueryResultItemIndexHeaderList.Add(new Pair <MultiIndexContainsQueryResultItem, IndexHeader>(multiIndexContainsQueryResultItem, indexHeader)); } } //ExceptionInfo ExceptionInfo = reader.ReadString(); }
public override void Deserialize(IPrimitiveReader reader, int version) { //ResultItemList int listCount = reader.ReadInt32(); ResultItemList = new List<ResultItem>(listCount); if (listCount > 0) { ResultItem resultItem; for (int i = 0; i < listCount; i++) { resultItem = new ResultItem(); resultItem.Deserialize(reader); ResultItemList.Add(resultItem); } } //IndexIdIndexHeaderMapping ushort count = reader.ReadUInt16(); if (count > 0) { IndexIdIndexHeaderMapping = new Dictionary<byte[], IndexHeader>(count, new ByteArrayEqualityComparer()); byte[] indexId; IndexHeader indexHeader; ushort len; for (ushort i = 0; i < count; i++) { len = reader.ReadUInt16(); indexId = null; if (len > 0) { indexId = reader.ReadBytes(len); } indexHeader = new IndexHeader(); Serializer.Deserialize(reader.BaseStream, indexHeader); IndexIdIndexHeaderMapping.Add(indexId, indexHeader); } } //TotalCount TotalCount = reader.ReadInt32(); //IsTagPrimarySort IsTagPrimarySort = reader.ReadBoolean(); //SortFieldName SortFieldName = reader.ReadString(); //SortOrderList count = reader.ReadUInt16(); SortOrderList = new List<SortOrder>(count); SortOrder sortOrder; for (int i = 0; i < count; i++) { sortOrder = new SortOrder(); sortOrder.Deserialize(reader); SortOrderList.Add(sortOrder); } //ExceptionInfo ExceptionInfo = reader.ReadString(); //AdditionalAvailableItemCount AdditionalAvailableItemCount = reader.ReadInt32(); }
public override void Deserialize(IPrimitiveReader reader, int version) { //ResultItemList int listCount = reader.ReadInt32(); ResultItemList = new List <ResultItem>(listCount); if (listCount > 0) { ResultItem resultItem; for (int i = 0; i < listCount; i++) { resultItem = new ResultItem(); resultItem.Deserialize(reader); ResultItemList.Add(resultItem); } } //IndexIdIndexHeaderMapping ushort count = reader.ReadUInt16(); ushort len; if (count > 0) { IndexIdIndexHeaderMapping = new Dictionary <byte[], IndexHeader>(count, new ByteArrayEqualityComparer()); byte[] indexId; IndexHeader indexHeader; for (ushort i = 0; i < count; i++) { len = reader.ReadUInt16(); indexId = null; if (len > 0) { indexId = reader.ReadBytes(len); } indexHeader = new IndexHeader(); Serializer.Deserialize(reader.BaseStream, indexHeader); IndexIdIndexHeaderMapping.Add(indexId, indexHeader); } } //TotalCount TotalCount = reader.ReadInt32(); //IsTagPrimarySort IsTagPrimarySort = reader.ReadBoolean(); //SortFieldName SortFieldName = reader.ReadString(); //SortOrderList count = reader.ReadUInt16(); SortOrderList = new List <SortOrder>(count); SortOrder sortOrder; for (int i = 0; i < count; i++) { sortOrder = new SortOrder(); sortOrder.Deserialize(reader); SortOrderList.Add(sortOrder); } //ExceptionInfo ExceptionInfo = reader.ReadString(); //AdditionalAvailableItemCount AdditionalAvailableItemCount = reader.ReadInt32(); //IndexCap if (version >= 2) { IndexCap = reader.ReadInt32(); } if (version >= 3) { if (reader.ReadBoolean()) { GroupByResult = new GroupByResult(new BaseComparer(IsTagPrimarySort, SortFieldName, SortOrderList)); Serializer.Deserialize(reader.BaseStream, GroupByResult); } } }
public override void Deserialize(IPrimitiveReader reader, int version) { // set the object's current version to the server's object version if (version < CORRECT_SERVERSIDE_PAGING_LOGIC_VERSION) { this.currentVersion = version; } //ResultItemList int listCount = reader.ReadInt32(); ResultItemList = new List <ResultItem>(listCount); if (listCount > 0) { ResultItem resultItem; for (int i = 0; i < listCount; i++) { resultItem = new ResultItem(); resultItem.Deserialize(reader); ResultItemList.Add(resultItem); } } //IndexIdIndexHeaderMapping ushort count = reader.ReadUInt16(); if (count > 0) { IndexIdIndexHeaderMapping = new Dictionary <byte[], IndexHeader>(count, new ByteArrayEqualityComparer()); byte[] indexId; IndexHeader indexHeader; ushort len; for (ushort i = 0; i < count; i++) { len = reader.ReadUInt16(); indexId = null; if (len > 0) { indexId = reader.ReadBytes(len); } indexHeader = new IndexHeader(); Serializer.Deserialize(reader.BaseStream, indexHeader); IndexIdIndexHeaderMapping.Add(indexId, indexHeader); } } //TotalCount TotalCount = reader.ReadInt32(); //IsTagPrimarySort IsTagPrimarySort = reader.ReadBoolean(); //SortFieldName SortFieldName = reader.ReadString(); //SortOrderList count = reader.ReadUInt16(); SortOrderList = new List <SortOrder>(count); SortOrder sortOrder; for (int i = 0; i < count; i++) { sortOrder = new SortOrder(); sortOrder.Deserialize(reader); SortOrderList.Add(sortOrder); } //ExceptionInfo ExceptionInfo = reader.ReadString(); if (version >= 2) { //PageableItemCount AdditionalAvailableItemCount = reader.ReadInt32(); } }
public void Deserialize(IPrimitiveReader reader, int version) { //ResultItemList int listCount = reader.ReadInt32(); if (listCount > 0) { ResultItemList = new List <IndexDataItem>(listCount); IndexDataItem resultItem; for (int i = 0; i < listCount; i++) { resultItem = new IndexDataItem(); resultItem.Deserialize(reader); ResultItemList.Add(resultItem); } } //IndexIdIndexHeaderMapping ushort count = reader.ReadUInt16(); if (count > 0) { IndexIdIndexHeaderMapping = new Dictionary <byte[], IndexHeader>(count, new ByteArrayEqualityComparer()); byte[] indexId; IndexHeader indexHeader; ushort len; for (ushort i = 0; i < count; i++) { len = reader.ReadUInt16(); indexId = null; if (len > 0) { indexId = reader.ReadBytes(len); } indexHeader = new IndexHeader(); Serializer.Deserialize(reader.BaseStream, indexHeader); IndexIdIndexHeaderMapping.Add(indexId, indexHeader); } } //LocalIdentityTagNames listCount = reader.ReadInt32(); if (listCount > 0) { LocalIdentityTagNames = new List <string>(listCount); for (int i = 0; i < listCount; i++) { LocalIdentityTagNames.Add(reader.ReadString()); } } //IsTagPrimarySort IsTagPrimarySort = reader.ReadBoolean(); //SortFieldName SortFieldName = reader.ReadString(); //SortOrderList count = reader.ReadUInt16(); SortOrderList = new List <SortOrder>(count); SortOrder sortOrder; for (int i = 0; i < count; i++) { sortOrder = new SortOrder(); sortOrder.Deserialize(reader); SortOrderList.Add(sortOrder); } //ExceptionInfo ExceptionInfo = reader.ReadString(); }
/// <summary> /// Gets the index header. /// </summary> /// <param name="targetIndex">Index of the target.</param> /// <param name="indexTypeMapping">The index type mapping.</param> /// <param name="typeId">The type id.</param> /// <param name="primaryId">The primary id.</param> /// <param name="storeContext">The store context.</param> /// <returns>IndexHeader</returns> private static IndexHeader GetIndexHeader(CacheIndexInternal targetIndex, IndexTypeMapping indexTypeMapping, short typeId, int primaryId, IndexStoreContext storeContext) { IndexHeader indexHeader = new IndexHeader(); #region Metadata if (indexTypeMapping.MetadataStoredSeperately) { #region Check if metadata is stored seperately //Send a get message to local index storage and fetch seperately stored metadata RelayMessage getMsg = new RelayMessage(typeId, primaryId, targetIndex.InDeserializationContext.IndexId, MessageType.Get); storeContext.IndexStorageComponent.HandleMessage(getMsg); if (getMsg.Payload != null) { indexHeader.Metadata = getMsg.Payload.ByteArray; } #endregion } else { #region Check metadata on targetIndex if (indexTypeMapping.IndexCollection[targetIndex.InDeserializationContext.IndexName].MetadataPresent) { indexHeader.Metadata = targetIndex.Metadata; } #endregion } #endregion #region VirtualCount indexHeader.VirtualCount = targetIndex.VirtualCount; #endregion return indexHeader; }