Ejemplo n.º 1
0
 public void WriteXml(XmlWriter writer)
 {
     writer.WriteStartElement("s");
     writer.WriteBase64(BitConverter.GetBytes(this.version), 0, 4);
     writer.WriteBase64(BitConverter.GetBytes(this.GetFieldCount()), 0, 2);
     byte[] fieldId = new byte[3];
     RequestInfo.BinarySerializationItem[] binarySerializationItems = RequestInfo.BinarySerializationItems;
     for (int i = 0; i < (int)binarySerializationItems.Length; i++)
     {
         RequestInfo.BinarySerializationItem binarySerializationItem = binarySerializationItems[i];
         if (binarySerializationItem.ShouldSerialize(this))
         {
             fieldId[0] = (byte)binarySerializationItem.FieldId;
             byte[] extractor = binarySerializationItem.Extractor(this);
             if ((int)extractor.Length > 65535)
             {
                 throw Fx.Exception.AsError(new SerializationException(SRClient.ExceededMessagePropertySizeLimit(binarySerializationItem.FieldId.ToString(), 65535)), null);
             }
             fieldId[1] = (byte)((int)extractor.Length & 255);
             fieldId[2] = (byte)(((int)extractor.Length & 65280) >> 8);
             writer.WriteBase64(fieldId, 0, 3);
             writer.WriteBase64(extractor, 0, (int)extractor.Length);
         }
     }
     writer.Flush();
     writer.WriteEndElement();
 }
Ejemplo n.º 2
0
 static RequestInfo()
 {
     RequestInfo.BinarySerializationItem[] binarySerializationItemArray  = new RequestInfo.BinarySerializationItem[16];
     RequestInfo.BinarySerializationItem[] binarySerializationItemArray1 = binarySerializationItemArray;
     RequestInfo.BinarySerializationItem   binarySerializationItem       = new RequestInfo.BinarySerializationItem()
     {
         FieldId         = RequestInfo.FieldId.ApiVersion,
         ShouldSerialize = (RequestInfo msg) => (int)(msg.initializedMembers & RequestInfo.RequestInfoFields.ApiVersion) != 0,
         Extractor       = (RequestInfo requestInfo) => SerializationUtilities.ConvertNativeValueToByteArray(requestInfo.version, PropertyValueType.Int32, requestInfo.ApiVersion)
     };
     binarySerializationItemArray1[0] = binarySerializationItem;
     RequestInfo.BinarySerializationItem[] binarySerializationItemArray2 = binarySerializationItemArray;
     RequestInfo.BinarySerializationItem   binarySerializationItem1      = new RequestInfo.BinarySerializationItem()
     {
         FieldId         = RequestInfo.FieldId.OperationTimeout,
         ShouldSerialize = (RequestInfo msg) => (int)(msg.initializedMembers & RequestInfo.RequestInfoFields.OperationTimeout) != 0,
         Extractor       = (RequestInfo requestInfo) => SerializationUtilities.ConvertNativeValueToByteArray(requestInfo.version, PropertyValueType.TimeSpan, requestInfo.OperationTimeout)
     };
     binarySerializationItemArray2[1] = binarySerializationItem1;
     RequestInfo.BinarySerializationItem[] binarySerializationItemArray3 = binarySerializationItemArray;
     RequestInfo.BinarySerializationItem   binarySerializationItem2      = new RequestInfo.BinarySerializationItem()
     {
         FieldId         = RequestInfo.FieldId.ServerTimeout,
         ShouldSerialize = (RequestInfo msg) => (int)(msg.initializedMembers & RequestInfo.RequestInfoFields.ServerTimeout) != 0,
         Extractor       = (RequestInfo requestInfo) => SerializationUtilities.ConvertNativeValueToByteArray(requestInfo.version, PropertyValueType.TimeSpan, requestInfo.ServerTimeout)
     };
     binarySerializationItemArray3[2] = binarySerializationItem2;
     RequestInfo.BinarySerializationItem[] binarySerializationItemArray4 = binarySerializationItemArray;
     RequestInfo.BinarySerializationItem   binarySerializationItem3      = new RequestInfo.BinarySerializationItem()
     {
         FieldId         = RequestInfo.FieldId.MessageId,
         ShouldSerialize = (RequestInfo msg) => (int)(msg.initializedMembers & RequestInfo.RequestInfoFields.MessageId) != 0,
         Extractor       = (RequestInfo requestInfo) => SerializationUtilities.ConvertNativeValueToByteArray(requestInfo.version, PropertyValueType.String, requestInfo.MessageId)
     };
     binarySerializationItemArray4[3] = binarySerializationItem3;
     RequestInfo.BinarySerializationItem[] binarySerializationItemArray5 = binarySerializationItemArray;
     RequestInfo.BinarySerializationItem   binarySerializationItem4      = new RequestInfo.BinarySerializationItem()
     {
         FieldId         = RequestInfo.FieldId.SessionId,
         ShouldSerialize = (RequestInfo msg) => (int)(msg.initializedMembers & RequestInfo.RequestInfoFields.SessionId) != 0,
         Extractor       = (RequestInfo requestInfo) => SerializationUtilities.ConvertNativeValueToByteArray(requestInfo.version, PropertyValueType.String, requestInfo.SessionId)
     };
     binarySerializationItemArray5[4] = binarySerializationItem4;
     RequestInfo.BinarySerializationItem[] binarySerializationItemArray6 = binarySerializationItemArray;
     RequestInfo.BinarySerializationItem   binarySerializationItem5      = new RequestInfo.BinarySerializationItem()
     {
         FieldId         = RequestInfo.FieldId.LockToken,
         ShouldSerialize = (RequestInfo msg) => (int)(msg.initializedMembers & RequestInfo.RequestInfoFields.LockToken) != 0,
         Extractor       = (RequestInfo requestInfo) => SerializationUtilities.ConvertNativeValueToByteArray(requestInfo.version, PropertyValueType.Guid, requestInfo.LockToken)
     };
     binarySerializationItemArray6[5] = binarySerializationItem5;
     RequestInfo.BinarySerializationItem[] binarySerializationItemArray7 = binarySerializationItemArray;
     RequestInfo.BinarySerializationItem   binarySerializationItem6      = new RequestInfo.BinarySerializationItem()
     {
         FieldId         = RequestInfo.FieldId.PartitionKey,
         ShouldSerialize = (RequestInfo msg) => (int)(msg.initializedMembers & RequestInfo.RequestInfoFields.PartitionKey) != 0,
         Extractor       = (RequestInfo requestInfo) => SerializationUtilities.ConvertNativeValueToByteArray(requestInfo.version, PropertyValueType.String, requestInfo.PartitionKey)
     };
     binarySerializationItemArray7[6] = binarySerializationItem6;
     RequestInfo.BinarySerializationItem[] binarySerializationItemArray8 = binarySerializationItemArray;
     RequestInfo.BinarySerializationItem   binarySerializationItem7      = new RequestInfo.BinarySerializationItem()
     {
         FieldId         = RequestInfo.FieldId.ViaPartitionKey,
         ShouldSerialize = (RequestInfo msg) => (int)(msg.initializedMembers & RequestInfo.RequestInfoFields.ViaPartitionKey) != 0,
         Extractor       = (RequestInfo requestInfo) => SerializationUtilities.ConvertNativeValueToByteArray(requestInfo.version, PropertyValueType.String, requestInfo.ViaPartitionKey)
     };
     binarySerializationItemArray8[7] = binarySerializationItem7;
     RequestInfo.BinarySerializationItem[] binarySerializationItemArray9 = binarySerializationItemArray;
     RequestInfo.BinarySerializationItem   binarySerializationItem8      = new RequestInfo.BinarySerializationItem()
     {
         FieldId         = RequestInfo.FieldId.PartitionId,
         ShouldSerialize = (RequestInfo msg) => (int)(msg.initializedMembers & RequestInfo.RequestInfoFields.PartitionId) != 0,
         Extractor       = (RequestInfo requestInfo) => SerializationUtilities.ConvertNativeValueToByteArray(requestInfo.version, PropertyValueType.Int16, requestInfo.PartitionId)
     };
     binarySerializationItemArray9[8] = binarySerializationItem8;
     RequestInfo.BinarySerializationItem[] binarySerializationItemArray10 = binarySerializationItemArray;
     RequestInfo.BinarySerializationItem   binarySerializationItem9       = new RequestInfo.BinarySerializationItem()
     {
         FieldId         = RequestInfo.FieldId.SequenceNumber,
         ShouldSerialize = (RequestInfo msg) => (int)(msg.initializedMembers & RequestInfo.RequestInfoFields.SequenceNumber) != 0,
         Extractor       = (RequestInfo requestInfo) => SerializationUtilities.ConvertNativeValueToByteArray(requestInfo.version, PropertyValueType.Int64, requestInfo.SequenceNumber)
     };
     binarySerializationItemArray10[9] = binarySerializationItem9;
     RequestInfo.BinarySerializationItem[] binarySerializationItemArray11 = binarySerializationItemArray;
     RequestInfo.BinarySerializationItem   binarySerializationItem10      = new RequestInfo.BinarySerializationItem()
     {
         FieldId         = RequestInfo.FieldId.Skip,
         ShouldSerialize = (RequestInfo msg) => (int)(msg.initializedMembers & RequestInfo.RequestInfoFields.Skip) != 0,
         Extractor       = (RequestInfo requestInfo) => SerializationUtilities.ConvertNativeValueToByteArray(requestInfo.version, PropertyValueType.Int32, requestInfo.Skip)
     };
     binarySerializationItemArray11[10] = binarySerializationItem10;
     RequestInfo.BinarySerializationItem[] binarySerializationItemArray12 = binarySerializationItemArray;
     RequestInfo.BinarySerializationItem   binarySerializationItem11      = new RequestInfo.BinarySerializationItem()
     {
         FieldId         = RequestInfo.FieldId.Top,
         ShouldSerialize = (RequestInfo msg) => (int)(msg.initializedMembers & RequestInfo.RequestInfoFields.Top) != 0,
         Extractor       = (RequestInfo requestInfo) => SerializationUtilities.ConvertNativeValueToByteArray(requestInfo.version, PropertyValueType.Int32, requestInfo.Top)
     };
     binarySerializationItemArray12[11] = binarySerializationItem11;
     RequestInfo.BinarySerializationItem[] binarySerializationItemArray13 = binarySerializationItemArray;
     RequestInfo.BinarySerializationItem   binarySerializationItem12      = new RequestInfo.BinarySerializationItem()
     {
         FieldId         = RequestInfo.FieldId.LastUpdatedTime,
         ShouldSerialize = (RequestInfo msg) => (int)(msg.initializedMembers & RequestInfo.RequestInfoFields.LastUpdatedTime) != 0,
         Extractor       = (RequestInfo requestInfo) => SerializationUtilities.ConvertNativeValueToByteArray(requestInfo.version, PropertyValueType.DateTime, requestInfo.LastUpdatedTime)
     };
     binarySerializationItemArray13[12] = binarySerializationItem12;
     RequestInfo.BinarySerializationItem[] binarySerializationItemArray14 = binarySerializationItemArray;
     RequestInfo.BinarySerializationItem   binarySerializationItem13      = new RequestInfo.BinarySerializationItem()
     {
         FieldId         = RequestInfo.FieldId.MessageCount,
         ShouldSerialize = (RequestInfo msg) => (int)(msg.initializedMembers & RequestInfo.RequestInfoFields.MessageCount) != 0,
         Extractor       = (RequestInfo requestInfo) => SerializationUtilities.ConvertNativeValueToByteArray(requestInfo.version, PropertyValueType.Int32, requestInfo.MessageCount)
     };
     binarySerializationItemArray14[13] = binarySerializationItem13;
     RequestInfo.BinarySerializationItem[] binarySerializationItemArray15 = binarySerializationItemArray;
     RequestInfo.BinarySerializationItem   binarySerializationItem14      = new RequestInfo.BinarySerializationItem()
     {
         FieldId         = RequestInfo.FieldId.TransactionId,
         ShouldSerialize = (RequestInfo msg) => (int)(msg.initializedMembers & RequestInfo.RequestInfoFields.TransactionId) != 0,
         Extractor       = (RequestInfo requestInfo) => SerializationUtilities.ConvertNativeValueToByteArray(requestInfo.version, PropertyValueType.String, requestInfo.TransactionId)
     };
     binarySerializationItemArray15[14] = binarySerializationItem14;
     RequestInfo.BinarySerializationItem[] binarySerializationItemArray16 = binarySerializationItemArray;
     RequestInfo.BinarySerializationItem   binarySerializationItem15      = new RequestInfo.BinarySerializationItem()
     {
         FieldId         = RequestInfo.FieldId.Destination,
         ShouldSerialize = (RequestInfo msg) => (int)(msg.initializedMembers & RequestInfo.RequestInfoFields.Destination) != 0,
         Extractor       = (RequestInfo requestInfo) => SerializationUtilities.ConvertNativeValueToByteArray(requestInfo.version, PropertyValueType.String, requestInfo.Destination)
     };
     binarySerializationItemArray16[15]   = binarySerializationItem15;
     RequestInfo.BinarySerializationItems = binarySerializationItemArray;
 }