/// <summary> /// Validates the field/property will not be duplicate in this object description. /// </summary> /// <param name="destination">The destination.</param> /// <param name="descriptor">The descriptor.</param> /// <exception cref="System.ArgumentException"></exception> private void ValidateValue(Category destination, BaseDescriptor descriptor) { if (Map[destination].ContainsKey(descriptor.SourceName)) { throw new ArgumentException(string.Format("{0} named {1} already exists", destination, descriptor.SourceName)); } }
/// <summary> /// Adds a property description of the represented object. /// </summary> /// <param name="property">The property.</param> public virtual void AddProperty(BaseDescriptor property) { ValidateCategory(Category.Property); ValidateValue(Category.Property, property); Map[Category.Property].Add(property.SourceName, property); }
/// <summary> /// Adds the field description of the represented object. /// </summary> /// <param name="field">The field.</param> public virtual void AddField(BaseDescriptor field) { ValidateCategory(Category.Field); ValidateValue(Category.Field, field); Map[Category.Field].Add(field.SourceName, field); }
public DescriptorDebugView(BaseDescriptor descriptorSource) { DescriptorSource = descriptorSource; }