Exemple #1
0
        public void UnsetValue(CompositeObject obj)
        {
            if (_wasSet)
            {
                var propToUnset = PropertyManager.Instance.GetProperties(obj.GetType())
                                  .FirstOrDefault(p => p.PropName == Property);

                obj.SetValue(propToUnset, Value);

                _oldValue = CompositeObjectProperty.UnsetValue;

                _wasSet = false;
            }
        }
Exemple #2
0
        public void SetValue(CompositeObject obj)
        {
            var propToSet = PropertyManager.Instance.GetProperties(obj.GetType())
                            .FirstOrDefault(p => p.PropName == Property);

            if (propToSet is null)
            {
                throw new Exception();
            }

            _wasSet = obj.IsPropertySet(propToSet);

            if (_wasSet)
            {
                _oldValue = obj.GetValue <IPropertyValue>(propToSet);
            }

            obj.SetValue(propToSet, Value);
        }