Exemple #1
0
        // FIXME: This doesn't seem to be the right class to have this method
        internal void ReadIDataRecord(int recordIndex, IDataRecord record, int [] mapping, int length)
        {
            if (mapping.Length > _table.Columns.Count)
            {
                throw new ArgumentException();
            }

            int i = 0;

            for (; i < length; i++)
            {
                DataColumn column = _table.Columns [mapping [i]];
                column.DataContainer.SetItemFromDataRecord(recordIndex, record, i);
            }

            for (; i < mapping.Length; i++)
            {
                DataColumn column = _table.Columns [mapping [i]];
                if (column.AutoIncrement)
                {
                    column.DataContainer [recordIndex] = column.AutoIncrementValue();
                }
                else
                {
                    column.DataContainer [recordIndex] = column.DefaultValue;
                }
            }
        }