public virtual string GetValue(string name) { DynamicDataProperty property = GetProperty(name, true); return(property == null ? String.Empty : property.Value); }
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); }
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; }