public void Deserialize(IPrimitiveReader reader, int version)
        {
            //MultiItemResult
            if (reader.ReadByte() != 0)
            {
                multiItemResult = new MultiItemResult();
                multiItemResult.Deserialize(reader);
            }

            //Metadata
            ushort len = reader.ReadUInt16();

            if (len > 0)
            {
                metadata = reader.ReadBytes(len);
            }

            //IndexSize
            indexSize = reader.ReadInt32();

            //IndexExists
            indexExists = reader.ReadBoolean();

            //ExceptionInfo
            exceptionInfo = reader.ReadString();

            //VirtualCount
            if (version >= 2)
            {
                virtualCount = reader.ReadInt32();
            }
        }
 private void Init(MultiItemResult multiItemResult, byte[] metadata, int indexSize, bool indexExists, int virtualCount, string exceptionInfo)
 {
     this.multiItemResult = multiItemResult;
     this.metadata        = metadata;
     this.indexSize       = indexSize;
     this.indexExists     = indexExists;
     this.virtualCount    = virtualCount;
     this.exceptionInfo   = exceptionInfo;
 }
 public ContainsIndexQueryResult(MultiItemResult multiItemResult,
                                 byte[] metadata,
                                 MetadataPropertyCollection metadataPropertyCollection,
                                 int indexSize,
                                 bool indexExists,
                                 int virtualCount,
                                 int indexCap,
                                 string exceptionInfo)
 {
     Init(multiItemResult, metadata, metadataPropertyCollection, indexSize, indexExists, virtualCount, indexCap, exceptionInfo);
 }
        public void Serialize(IPrimitiveWriter writer)
        {
            //MultiItemResult
            if (MultiItemResult == null || MultiItemResult.Count == 0)
            {
                writer.Write((byte)0);
            }
            else
            {
                writer.Write((byte)1);
                MultiItemResult.Serialize(writer);
            }

            //Metadata
            if (Metadata == null || Metadata.Length == 0)
            {
                writer.Write((ushort)0);
            }
            else
            {
                writer.Write((ushort)Metadata.Length);
                writer.Write(Metadata);
            }

            //IndexSize
            writer.Write(IndexSize);

            //IndexExists
            writer.Write(IndexExists);

            //ExceptionInfo
            writer.Write(ExceptionInfo);

            //VirtualCount
            writer.Write(VirtualCount);

            //IndexCap
            writer.Write(IndexCap);

            //MetadataPropertyCollection
            if (MetadataPropertyCollection == null)
            {
                writer.Write(false);
            }
            else
            {
                writer.Write(true);
                Serializer.Serialize(writer.BaseStream, MetadataPropertyCollection);
            }
        }
        public void Deserialize(IPrimitiveReader reader, int version)
        {
            //MultiItemResult
            if (reader.ReadByte() != 0)
            {
                MultiItemResult = new MultiItemResult();
                MultiItemResult.Deserialize(reader);
            }

            //Metadata
            ushort len = reader.ReadUInt16();

            if (len > 0)
            {
                Metadata = reader.ReadBytes(len);
            }

            //IndexSize
            IndexSize = reader.ReadInt32();

            //IndexExists
            IndexExists = reader.ReadBoolean();

            //ExceptionInfo
            ExceptionInfo = reader.ReadString();

            //VirtualCount
            if (version >= 2)
            {
                VirtualCount = reader.ReadInt32();
            }

            //IndexCap
            if (version >= 3)
            {
                IndexCap = reader.ReadInt32();
            }

            if (version >= 4)
            {
                //MetadataPropertyCollection
                if (reader.ReadBoolean())
                {
                    MetadataPropertyCollection = new MetadataPropertyCollection();
                    Serializer.Deserialize(reader.BaseStream, MetadataPropertyCollection);
                }
            }
        }
 private void Init(MultiItemResult multiItemResult,
                   byte[] metadata,
                   MetadataPropertyCollection metadataPropertyCollection,
                   int indexSize,
                   bool indexExists,
                   int virtualCount,
                   int indexCap,
                   string exceptionInfo)
 {
     MultiItemResult            = multiItemResult;
     Metadata                   = metadata;
     MetadataPropertyCollection = metadataPropertyCollection;
     IndexSize                  = indexSize;
     IndexExists                = indexExists;
     VirtualCount               = virtualCount;
     ExceptionInfo              = exceptionInfo;
     IndexCap                   = indexCap;
 }
 public ContainsIndexQueryResult(MultiItemResult multiItemResult, byte[] metadata, int indexSize, bool indexExists, int virtualCount, string exceptionInfo)
 {
     Init(multiItemResult, metadata, indexSize, indexExists, virtualCount, exceptionInfo);
 }