Exemplo n.º 1
0
        public object this[int index]
        {
            get
            {
                if (_list.DataTypes[index] is Schema.IScalarType)
                {
                    return(_list.Values[index]);
                }
                return(FromNativeList(Manager, DataType, _list, index));
            }
            set
            {
                DisposeValueAt(index);

                DataValue tempValue = value as DataValue;
                if (tempValue != null)
                {
                    _list.DataTypes[index] = tempValue.DataType;
                    _list.Values[index]    = tempValue.CopyNative();
                }
                else
                {
                    _list.DataTypes[index] = DataType.ElementType;
                    _list.Values[index]    = value;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>This is a by-reference access of the value, changes made to the resulting DataValue will be refelected in the actual row.</summary>
        public object this[int index]
        {
            get
            {
                                #if USEDATATYPESINNATIVEROW
                if (_row.DataTypes[index] is Schema.IScalarType)
                                #else
                if (DataType.Columns[AIndex].DataType is Schema.IScalarType)
                                #endif
                { return(_row.Values[index]); }
                return(FromNativeRow(Manager, DataType, _row, index));
            }
            set
            {
                if (_row.Values[index] != null)
                                        #if USEDATATYPESINNATIVEROW
                { DataValue.DisposeNative(Manager, _row.DataTypes[index], _row.Values[index]); }
                                        #else
                { DataValue.DisposeNative(Manager, DataType.Columns[AIndex].DataType, FRow.Values[AIndex]); }
                                        #endif

                IDataValue tempValue = value as IDataValue;
                if (tempValue != null)
                {
                                        #if USEDATATYPESINNATIVEROW
                    _row.DataTypes[index] = tempValue.DataType;
                                        #endif
                    _row.Values[index] = tempValue.CopyNative();
                }
                else if (value != null)
                {
                                        #if USEDATATYPESINNATIVEROW
                    if ((DataType.Columns[index].DataType.Equals(Manager.DataTypes.SystemGeneric)) || (DataType.Columns[index].DataType.Equals(Manager.DataTypes.SystemScalar)))
                    {
                        _row.DataTypes[index] = Manager.GetRuntimeType(value.GetType());
                    }
                    else
                    {
                        _row.DataTypes[index] = DataType.Columns[index].DataType;
                    }
                    _row.Values[index] = DataValue.CopyNative(Manager, _row.DataTypes[index], value);
                                        #else
                    FRow.Values[AIndex] = DataValue.CopyNative(Manager, DataType.Columns[AIndex].DataType, value);
                                        #endif
                }
                else
                {
                                        #if USEDATATYPESINNATIVEROW
                    _row.DataTypes[index] = DataType.Columns[index].DataType;
                                        #endif
                    _row.Values[index] = null;
                }

                if (_row.ModifiedFlags != null)
                {
                    _row.ModifiedFlags[index] = true;
                }
            }
        }
Exemplo n.º 3
0
        public override object CopyNativeAs(Schema.IDataType dataType)
        {
            NativeList newList = new NativeList();

            for (int index = 0; index < _list.DataTypes.Count; index++)
            {
                newList.DataTypes.Add(_list.DataTypes[index]);
                newList.Values.Add(DataValue.CopyNative(Manager, _list.DataTypes[index], _list.Values[index]));
            }
            return(newList);
        }
Exemplo n.º 4
0
        public void Insert(int index, object tempValue)
        {
            DataValue localTempValue = tempValue as DataValue;

            if (localTempValue != null)
            {
                _list.DataTypes.Insert(index, localTempValue.DataType);
                _list.Values.Insert(index, localTempValue.CopyNative());
            }
            else
            {
                _list.DataTypes.Insert(index, DataType.ElementType);
                _list.Values.Insert(index, tempValue);
            }
        }
Exemplo n.º 5
0
        public int Add(object tempValue)
        {
            int       index          = _list.DataTypes.Count;
            DataValue localTempValue = tempValue as DataValue;

            if (localTempValue != null)
            {
                _list.DataTypes.Add(localTempValue.DataType);
                _list.Values.Add(localTempValue.CopyNative());
            }
            else
            {
                _list.DataTypes.Add(DataType.ElementType);
                _list.Values.Add(tempValue);
            }
            return(index);
        }
Exemplo n.º 6
0
        public override object CopyNativeAs(Schema.IDataType dataType)
        {
            if (IsNative)
            {
                ICloneable cloneable = Value as ICloneable;
                if (cloneable != null)
                {
                    return(cloneable.Clone());
                }

                if (DataType.IsCompound)
                {
                    return(DataValue.CopyNative(Manager, DataType.CompoundRowType, Value));
                }

                return(Value);
            }

            if (StreamID == StreamID.Null)
            {
                return(StreamID);
            }
            return(Manager.StreamManager.Reference(StreamID));
        }
Exemplo n.º 7
0
 public NativeRow CopyData(IValueManager manager, NativeRow sourceData)
 {
     return((NativeRow)DataValue.CopyNative(manager, DataRowType, sourceData));
 }
Exemplo n.º 8
0
 public NativeRow CopyKey(IValueManager manager, NativeRow sourceKey)
 {
     return((NativeRow)DataValue.CopyNative(manager, KeyRowType, sourceKey));
 }