/// <summary>
 /// Reads an array of SingleRow-Tables (macro data type).
 /// </summary>
 /// <returns>Array of SingleRow-Tables as read from the underlying byte buffer.</returns>
 public SingleRowTable[] ReadSingleRowTableArray()
 {
     int count = Cnv.GetInt16(this.Input, this.Position);
     this.Position += 2;
     SingleRowTable[] result = new SingleRowTable[count];
     for (int i = 0; i < count; i++)
         result[i] = new SingleRowTable(this);
     return result;
 }
        /// <summary>
        /// Instantiate a strongly-typed Table Wrapper around the given generic Table.
        /// </summary>
        /// <param name="table">The single-row table to build the wrapper for.</param>
        internal SingleRowTable(SingleRowTable table)
        {
            // Validate column count.
            if (table.ColumnCount != 8)
            {
                throw new VoltInvalidDataException(Resources.InvalidColumnCount, table.ColumnCount);
            }

            // Validate column data types.
            if (!(VoltType.ToDefaultNetType(table.GetColumnDBType(0)) == (typeof(T1))))
            {
                throw new VoltInvalidCastException(
                          Resources.InvalidCastException
                          , VoltType.ToDefaultNetType(table.GetColumnDBType(0)).ToString()
                          , typeof(T1).ToString()
                          );
            }

            if (!(VoltType.ToDefaultNetType(table.GetColumnDBType(1)) == (typeof(T2))))
            {
                throw new VoltInvalidCastException(
                          Resources.InvalidCastException
                          , VoltType.ToDefaultNetType(table.GetColumnDBType(1)).ToString()
                          , typeof(T2).ToString()
                          );
            }

            if (!(VoltType.ToDefaultNetType(table.GetColumnDBType(2)) == (typeof(T3))))
            {
                throw new VoltInvalidCastException(
                          Resources.InvalidCastException
                          , VoltType.ToDefaultNetType(table.GetColumnDBType(2)).ToString()
                          , typeof(T3).ToString()
                          );
            }

            if (!(VoltType.ToDefaultNetType(table.GetColumnDBType(3)) == (typeof(T4))))
            {
                throw new VoltInvalidCastException(
                          Resources.InvalidCastException
                          , VoltType.ToDefaultNetType(table.GetColumnDBType(3)).ToString()
                          , typeof(T4).ToString()
                          );
            }

            if (!(VoltType.ToDefaultNetType(table.GetColumnDBType(4)) == (typeof(T5))))
            {
                throw new VoltInvalidCastException(
                          Resources.InvalidCastException
                          , VoltType.ToDefaultNetType(table.GetColumnDBType(4)).ToString()
                          , typeof(T5).ToString()
                          );
            }

            if (!(VoltType.ToDefaultNetType(table.GetColumnDBType(5)) == (typeof(T6))))
            {
                throw new VoltInvalidCastException(
                          Resources.InvalidCastException
                          , VoltType.ToDefaultNetType(table.GetColumnDBType(5)).ToString()
                          , typeof(T6).ToString()
                          );
            }

            if (!(VoltType.ToDefaultNetType(table.GetColumnDBType(6)) == (typeof(T7))))
            {
                throw new VoltInvalidCastException(
                          Resources.InvalidCastException
                          , VoltType.ToDefaultNetType(table.GetColumnDBType(6)).ToString()
                          , typeof(T7).ToString()
                          );
            }

            if (!(VoltType.ToDefaultNetType(table.GetColumnDBType(7)) == (typeof(T8))))
            {
                throw new VoltInvalidCastException(
                          Resources.InvalidCastException
                          , VoltType.ToDefaultNetType(table.GetColumnDBType(7)).ToString()
                          , typeof(T8).ToString()
                          );
            }

            // Validation complete, keep a reference to the raw table.
            this.RawTable = table;
        }