示例#1
0
        /// <summary>
        /// Gets the values from entity.
        /// </summary>
        /// <param name="entityDictionary">The entity dictionary containing property name <see cref="StorageItem" pairs./>.</param>
        internal void GetValuesFromEntity(Dictionary <string, StorageItem> entityDictionary)
        {
            ITrackOriginalValues _entity = (ITrackOriginalValues)this.TEntityGetter;

            foreach (var _ovx in _entity.OriginalValues)
            {
                StorageItem _storage = entityDictionary[_ovx.Key];
                object      _value   = _storage.Storage.GetValue(_entity);
                if (_storage.Association)
                {
                    Debug.Assert(_storage.IsLookup, "Unexpected MultivalueType in the GetValuesFromEntity. Expected is lookup, but the filde is reverse lookup");
                    _value = ((IEntityRef)_value).GetLookup(m_DataContext, ((AssociationAttribute)_storage.Description).List);
                }
                else if (((ColumnAttribute)_storage.Description).FieldType.Contains("Choice"))
                {
                    Dictionary <string, string> _values = new Dictionary <string, string>();
                    Type _type = StorageItem.GetEnumValues(_storage, _values, true);
                    _value = _values[_value.ToString()];
                }
                MyListItem[_storage.Description.Name] = _value;
            }
            MyListItem.Update();
            _entity.OriginalValues.Clear();
            EntityState = EntityState.Unchanged;
        }
示例#2
0
        /// <summary>
        /// Gets the values from entity.
        /// </summary>
        /// <param name="entityDictionary">The entity dictionary containing property name <see cref="StorageItem"/>pairs..</param>
        internal void GetValuesFromEntity(Dictionary <string, StorageItem> entityDictionary)
        {
            ITrackOriginalValues _entity = (ITrackOriginalValues)this.TEntityGetter;

            foreach (var _ovx in _entity.OriginalValues)
            {
                StorageItem _storage = entityDictionary[_ovx.Key];
                _storage.GetValueFromEntity(_entity, (name, value) => MyListItem[name] = value);
            }
            MyListItem.Update();
            _entity.OriginalValues.Clear();
            EntityState = EntityState.Unchanged;
        }