Exemple #1
0
        /// <summary>
        /// Les données sont extraites de la ligne en cours du reader.
        /// </summary>
        public void SetValuesToClassProxy(ClassProxy _proxy, DBRow _row)
        {
            _proxy.ID = _row.GetId();

            for (int _i = 0; _i < _row.Count; _i++)
            {
                DBField _field        = _row.GetField(_i);
                string  _propertyName = _field.PropertyName;

                PropertyProxy _prProxy = _proxy.GetPropertyProxy(_propertyName);

                if (_prProxy != null)
                {
                    SetValueToProperty(_prProxy, _field.Value);
                }
            }
        }
Exemple #2
0
        private void Init(NpgsqlDataReader _reader)
        {
            if (_reader == null)
            {
                return;
            }

            __rows = new List <DBRow>();

            DBRow _row = null;

            using (_reader)
            {
                while (_reader.HasRows)
                {
                    while (_reader.Read())
                    {
                        if (_reader.FieldCount > 0)
                        {
                            string _firstColumn = _reader.GetName(0);

                            for (int _i = 0; _i < _reader.FieldCount; _i++)
                            {
                                DBField _field = new DBField();
                                _field.Name  = _reader.GetName(_i);
                                _field.Value = _reader.GetValue(_i);

                                if (_field.Name == _firstColumn)
                                {
                                    _row = new DBRow();
                                    __rows.Add(_row);
                                }
                                _row.Add(_field);
                            }
                        }
                    }
                    _reader.NextResult();
                }
            }
        }