Ejemplo n.º 1
0
        private void WriteRow(BinaryWriter writer, SerializationRow dataRow, SerializationColumn[] columns, SerializationType[] types)
        {
            var headerPosition = writer.GetPosition();
            var valueOffsets   = new int[columns.Length];
            var byteLength     = 0;

            writer.Write(byteLength);
            var fieldPosition = writer.GetPosition();

            writer.WriteArray(valueOffsets);

            for (var i = 0; i < columns.Length; i++)
            {
                var dataColumn = columns[i];
                var value      = dataRow.Fields[i];

                if (value == null || value == DBNull.Value)
                {
                    continue;
                }

                valueOffsets[i] = (int)(writer.GetPosition() - fieldPosition);
                this.WriteField(writer, dataColumn, value, types);
            }

            var lastPosition = writer.GetPosition();

            byteLength = (int)(lastPosition - fieldPosition);

            writer.SetPosition(headerPosition);
            writer.WriteValue(byteLength);
            writer.WriteArray(valueOffsets);
            writer.SetPosition(lastPosition);
        }
Ejemplo n.º 2
0
 public static SerializationRowResponse ConvertFrom(SerializationRow serializationRow)
 {
     return(new SerializationRowResponse
     {
         Tags = serializationRow.Tags,
         DerivedTags = serializationRow.DerivedTags,
         Fields = serializationRow.Fields,
         RelationID = serializationRow.RelationID,
         ParentID = serializationRow.ParentID
     });
 }