예제 #1
0
 private void Init(List <byte[]> indexIdList,
                   List <int> primaryIdList,
                   string targetIndexName,
                   List <string> tagsFromIndexes,
                   TagSort tagSort,
                   int maxItems,
                   bool excludeData,
                   bool getIndexHeader,
                   Dictionary <byte[], IndexIdParams> indexIdParamsMapping,
                   bool getAdditionalAvailableItemCount,
                   Filter filter,
                   FullDataIdInfo fullDataIdInfo,
                   IndexCondition indexCondition,
                   bool clientSideSubsetProcessingRequired,
                   CapCondition capCondition,
                   GetIndexHeaderType getIndexHeaderType,
                   DomainSpecificProcessingType domainSpecificProcessingType,
                   GroupBy groupBy)
 {
     IndexIdList                     = indexIdList;
     PrimaryIdList                   = primaryIdList;
     TargetIndexName                 = targetIndexName;
     TagsFromIndexes                 = tagsFromIndexes;
     TagSort                         = tagSort;
     MaxItems                        = maxItems;
     ExcludeData                     = excludeData;
     GetIndexHeader                  = getIndexHeader;
     IndexIdParamsMapping            = indexIdParamsMapping;
     GetAdditionalAvailableItemCount = getAdditionalAvailableItemCount;
     Filter         = filter;
     FullDataIdInfo = fullDataIdInfo;
     IndexCondition = indexCondition;
     ClientSideSubsetProcessingRequired = clientSideSubsetProcessingRequired;
     CapCondition                 = capCondition;
     GetIndexHeaderType           = getIndexHeaderType;
     DomainSpecificProcessingType = domainSpecificProcessingType;
     GroupBy = groupBy;
 }
예제 #2
0
        public override void Deserialize(IPrimitiveReader reader, int version)
        {
            //PageSize
            PageSize = reader.ReadInt32();

            //PageNum
            PageNum = reader.ReadInt32();

            //TargetIndexName
            TargetIndexName = reader.ReadString();

            //TagsFromIndexes
            ushort count = reader.ReadUInt16();

            if (count > 0)
            {
                TagsFromIndexes = new List <string>(count);
                for (ushort i = 0; i < count; i++)
                {
                    TagsFromIndexes.Add(reader.ReadString());
                }
            }

            //TagSort
            if (reader.ReadByte() != 0)
            {
                TagSort = new TagSort();
                Serializer.Deserialize(reader.BaseStream, TagSort);
            }

            //IndexIdList
            count = reader.ReadUInt16();
            if (count > 0)
            {
                IndexIdList = new List <byte[]>(count);
                ushort len;
                for (ushort i = 0; i < count; i++)
                {
                    len = reader.ReadUInt16();
                    if (len > 0)
                    {
                        IndexIdList.Add(reader.ReadBytes(len));
                    }
                }
            }

            //Read a byte to account for deprecated CriterionList
            reader.ReadByte();

            //MaxItemsPerIndex
            MaxItemsPerIndex = reader.ReadInt32();

            //ExcludeData
            ExcludeData = reader.ReadBoolean();

            //GetIndexHeader
            GetIndexHeader = reader.ReadBoolean();

            if (version >= 2)
            {
                //GetPageableItemCount
                GetPageableItemCount = reader.ReadBoolean();
            }

            if (version >= 3)
            {
                //PrimaryIdList
                count = reader.ReadUInt16();
                if (count > 0)
                {
                    PrimaryIdList = new List <int>(count);
                    for (ushort i = 0; i < count; i++)
                    {
                        PrimaryIdList.Add(reader.ReadInt32());
                    }
                }
            }

            if (version >= 4)
            {
                //Filter
                byte b = reader.ReadByte();
                if (b != 0)
                {
                    FilterType filterType = (FilterType)b;
                    Filter = FilterFactory.CreateFilter(reader, filterType);
                }
            }

            if (version >= 5)
            {
                //IndexIdParamsMapping
                count = reader.ReadUInt16();
                if (count > 0)
                {
                    IndexIdParamsMapping = new Dictionary <byte[], IndexIdParams>(count, new ByteArrayEqualityComparer());
                    byte[]        indexId;
                    IndexIdParams indexIdParam;
                    ushort        len;

                    for (ushort i = 0; i < count; i++)
                    {
                        len     = reader.ReadUInt16();
                        indexId = null;
                        if (len > 0)
                        {
                            indexId = reader.ReadBytes(len);

                            indexIdParam = new IndexIdParams();
                            Serializer.Deserialize(reader.BaseStream, indexIdParam);

                            IndexIdParamsMapping.Add(indexId, indexIdParam);
                        }
                    }
                }
            }

            if (version >= 6)
            {
                //FullDataIdInfo
                if (reader.ReadBoolean())
                {
                    FullDataIdInfo = new FullDataIdInfo();
                    Serializer.Deserialize(reader.BaseStream, FullDataIdInfo);
                }
            }

            if (version >= 7)
            {
                //ClientSidePaging
                ClientSidePaging = reader.ReadBoolean();
            }

            if (version >= 8)
            {
                //IndexCondition
                if (reader.ReadBoolean())
                {
                    IndexCondition = new IndexCondition();
                    Serializer.Deserialize(reader.BaseStream, IndexCondition);
                }
            }

            if (version >= 9)
            {
                //CapCondition
                if (reader.ReadBoolean())
                {
                    CapCondition = new CapCondition();
                    Serializer.Deserialize(reader.BaseStream, CapCondition);
                }
            }

            if (version >= 10)
            {
                //GetIndexHeaderType
                GetIndexHeaderType = (GetIndexHeaderType)reader.ReadByte();
            }

            if (version >= 11)
            {
                //DomainSpecificProcessingType
                DomainSpecificProcessingType = (DomainSpecificProcessingType)reader.ReadByte();
            }

            if (version >= 12)
            {
                //GroupBy
                if (reader.ReadBoolean())
                {
                    GroupBy = new GroupBy();
                    Serializer.Deserialize(reader.BaseStream, GroupBy);
                }
            }
        }