示例#1
0
        public virtual string GetValue(string name)
        {
            DynamicDataProperty property = GetProperty(name, true);

            return(property == null
                       ? String.Empty
                       : property.Value);
        }
示例#2
0
        private DynamicDataProperty GetProperty(string name, bool ensureExist)
        {
            DynamicDataProperty property =
                Properties.FirstOrDefault(x => x.Name.Equals(name, StringComparison.OrdinalIgnoreCase));

            if (property == null && ensureExist)
            {
                property = new DynamicDataProperty {
                    Name = name
                };
                Properties.Add(property);
            }

            return(property);
        }
示例#3
0
        public virtual void SetValue(string name, string value)
        {
            DynamicDataProperty property = GetProperty(name, true);
            object oldValue = property.Value;
            string newValue = value;

            property.Value = newValue;

            // ReSharper disable CompareNonConstrainedGenericWithNull
            bool changed = oldValue == null
                               ? newValue != null
                               : !oldValue.Equals(newValue);

            // ReSharper restore CompareNonConstrainedGenericWithNull

            IsChanged = IsChanged || changed;
        }