/// <summary>
        /// Converts <see cref="System.Data.DataRow"/> to <see cref="IPAddressViewRow"/>.
        /// </summary>
        /// <param name="row">The <see cref="System.Data.DataRow"/> object to be mapped.</param>
        /// <returns>A reference to the <see cref="IPAddressViewRow"/> object.</returns>
        protected virtual IPAddressViewRow MapRow(DataRow row)
        {
            IPAddressViewRow mappedObject = new IPAddressViewRow();
            DataTable        dataTable    = row.Table;
            DataColumn       dataColumn;

            // Column "IP_address"
            dataColumn = dataTable.Columns["IP_address"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.IP_address = (int)row[dataColumn];
            }
            // Column "Dot_IP_address"
            dataColumn = dataTable.Columns["Dot_IP_address"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Dot_IP_address = (string)row[dataColumn];
            }
            // Column "End_point_id"
            dataColumn = dataTable.Columns["End_point_id"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.End_point_id = (short)row[dataColumn];
            }
            // Column "Alias"
            dataColumn = dataTable.Columns["Alias"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Alias = (string)row[dataColumn];
            }
            // Column "With_alias_authentication"
            dataColumn = dataTable.Columns["With_alias_authentication"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.With_alias_authentication = (byte)row[dataColumn];
            }
            // Column "Status"
            dataColumn = dataTable.Columns["Status"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Status = (byte)row[dataColumn];
            }
            // Column "Type"
            dataColumn = dataTable.Columns["Type"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Type = (byte)row[dataColumn];
            }
            // Column "Protocol"
            dataColumn = dataTable.Columns["Protocol"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Protocol = (byte)row[dataColumn];
            }
            // Column "Port"
            dataColumn = dataTable.Columns["Port"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Port = (int)row[dataColumn];
            }
            // Column "Registration"
            dataColumn = dataTable.Columns["Registration"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Registration = (byte)row[dataColumn];
            }
            // Column "Is_registered"
            dataColumn = dataTable.Columns["Is_registered"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Is_registered = (byte)row[dataColumn];
            }
            // Column "IP_address_range"
            dataColumn = dataTable.Columns["IP_address_range"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.IP_address_range = (string)row[dataColumn];
            }
            // Column "Max_calls"
            dataColumn = dataTable.Columns["Max_calls"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Max_calls = (int)row[dataColumn];
            }
            // Column "Password"
            dataColumn = dataTable.Columns["Password"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Password = (string)row[dataColumn];
            }
            // Column "Prefix_in_type_id"
            dataColumn = dataTable.Columns["Prefix_in_type_id"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Prefix_in_type_id = (short)row[dataColumn];
            }
            // Column "Prefix_type_descr"
            dataColumn = dataTable.Columns["Prefix_type_descr"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Prefix_type_descr = (string)row[dataColumn];
            }
            // Column "Prefix_length"
            dataColumn = dataTable.Columns["Prefix_length"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Prefix_length = (byte)row[dataColumn];
            }
            // Column "Prefix_delimiter"
            dataColumn = dataTable.Columns["Prefix_delimiter"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Prefix_delimiter = (byte)row[dataColumn];
            }
            return(mappedObject);
        }
        /// <summary>
        /// Reads data from the provided data reader and returns
        /// an array of mapped objects.
        /// </summary>
        /// <param name="reader">The <see cref="System.Data.IDataReader"/> object to read data from the view.</param>
        /// <param name="startIndex">The index of the first record to map.</param>
        /// <param name="length">The number of records to map.</param>
        /// <param name="totalRecordCount">A reference parameter that returns the total number
        /// of records in the reader object if 0 was passed into the method; otherwise it returns -1.</param>
        /// <returns>An array of <see cref="IPAddressViewRow"/> objects.</returns>
        protected virtual IPAddressViewRow[] MapRecords(IDataReader reader,
                                                        int startIndex, int length, ref int totalRecordCount)
        {
            if (0 > startIndex)
            {
                throw new ArgumentOutOfRangeException("startIndex", startIndex, "StartIndex cannot be less than zero.");
            }
            if (0 > length)
            {
                throw new ArgumentOutOfRangeException("length", length, "Length cannot be less than zero.");
            }

            int iP_addressColumnIndex                = reader.GetOrdinal("IP_address");
            int dot_IP_addressColumnIndex            = reader.GetOrdinal("dot_IP_address");
            int end_point_idColumnIndex              = reader.GetOrdinal("end_point_id");
            int aliasColumnIndex                     = reader.GetOrdinal("alias");
            int with_alias_authenticationColumnIndex = reader.GetOrdinal("with_alias_authentication");
            int statusColumnIndex                    = reader.GetOrdinal("status");
            int typeColumnIndex              = reader.GetOrdinal("type");
            int protocolColumnIndex          = reader.GetOrdinal("protocol");
            int portColumnIndex              = reader.GetOrdinal("port");
            int registrationColumnIndex      = reader.GetOrdinal("registration");
            int is_registeredColumnIndex     = reader.GetOrdinal("is_registered");
            int iP_address_rangeColumnIndex  = reader.GetOrdinal("IP_address_range");
            int max_callsColumnIndex         = reader.GetOrdinal("max_calls");
            int passwordColumnIndex          = reader.GetOrdinal("password");
            int prefix_in_type_idColumnIndex = reader.GetOrdinal("prefix_in_type_id");
            int prefix_type_descrColumnIndex = reader.GetOrdinal("prefix_type_descr");
            int prefix_lengthColumnIndex     = reader.GetOrdinal("prefix_length");
            int prefix_delimiterColumnIndex  = reader.GetOrdinal("prefix_delimiter");

            System.Collections.ArrayList recordList = new System.Collections.ArrayList();
            int ri = -startIndex;

            while (reader.Read())
            {
                ri++;
                if (ri > 0 && ri <= length)
                {
                    IPAddressViewRow record = new IPAddressViewRow();
                    recordList.Add(record);

                    record.IP_address = Convert.ToInt32(reader.GetValue(iP_addressColumnIndex));
                    if (!reader.IsDBNull(dot_IP_addressColumnIndex))
                    {
                        record.Dot_IP_address = Convert.ToString(reader.GetValue(dot_IP_addressColumnIndex));
                    }
                    record.End_point_id = Convert.ToInt16(reader.GetValue(end_point_idColumnIndex));
                    record.Alias        = Convert.ToString(reader.GetValue(aliasColumnIndex));
                    record.With_alias_authentication = Convert.ToByte(reader.GetValue(with_alias_authenticationColumnIndex));
                    record.Status            = Convert.ToByte(reader.GetValue(statusColumnIndex));
                    record.Type              = Convert.ToByte(reader.GetValue(typeColumnIndex));
                    record.Protocol          = Convert.ToByte(reader.GetValue(protocolColumnIndex));
                    record.Port              = Convert.ToInt32(reader.GetValue(portColumnIndex));
                    record.Registration      = Convert.ToByte(reader.GetValue(registrationColumnIndex));
                    record.Is_registered     = Convert.ToByte(reader.GetValue(is_registeredColumnIndex));
                    record.IP_address_range  = Convert.ToString(reader.GetValue(iP_address_rangeColumnIndex));
                    record.Max_calls         = Convert.ToInt32(reader.GetValue(max_callsColumnIndex));
                    record.Password          = Convert.ToString(reader.GetValue(passwordColumnIndex));
                    record.Prefix_in_type_id = Convert.ToInt16(reader.GetValue(prefix_in_type_idColumnIndex));
                    record.Prefix_type_descr = Convert.ToString(reader.GetValue(prefix_type_descrColumnIndex));
                    record.Prefix_length     = Convert.ToByte(reader.GetValue(prefix_lengthColumnIndex));
                    record.Prefix_delimiter  = Convert.ToByte(reader.GetValue(prefix_delimiterColumnIndex));

                    if (ri == length && 0 != totalRecordCount)
                    {
                        break;
                    }
                }
            }

            totalRecordCount = 0 == totalRecordCount ? ri + startIndex : -1;
            return((IPAddressViewRow[])(recordList.ToArray(typeof(IPAddressViewRow))));
        }