/// <summary> /// Converts an Acma attribute modification type to a MetadirectoryServices modification type /// </summary> /// <param name="modificationType">The Acma modification type</param> /// <returns>The MetadirectoryServices modification type</returns> private AttributeModificationType GetStandardModificationType(AcmaAttributeModificationType modificationType) { switch (modificationType) { case AcmaAttributeModificationType.Add: return(AttributeModificationType.Add); case AcmaAttributeModificationType.Replace: return(AttributeModificationType.Replace); case AcmaAttributeModificationType.Delete: return(AttributeModificationType.Delete); case AcmaAttributeModificationType.Conditional: throw new InvalidOperationException("Cannot convert a conditional modification type to a MetadirectoryServices modification type"); default: throw new UnknownOrUnsupportedModificationTypeException(); } }
/// <summary> /// Applies the value changes created by the constructor to the underlying object, using the requested modification type to define how to apply the new values /// </summary> /// <param name="hologram">The object to apply the changes to</param> /// <param name="valueChanges">The value changes to apply</param> /// <param name="modificationType">The type of modification to apply to the object</param> protected void ApplyValueChanges(MAObjectHologram hologram, IList <ValueChange> valueChanges, AcmaAttributeModificationType modificationType) { switch (modificationType) { case AcmaAttributeModificationType.Add: hologram.UpdateAttributeValue(this.Attribute, valueChanges); break; case AcmaAttributeModificationType.Replace: hologram.SetAttributeValue(this.Attribute, valueChanges.Select(t => t.Value).ToList <object>()); break; case AcmaAttributeModificationType.Delete: hologram.UpdateAttributeValue(this.Attribute, valueChanges); break; default: throw new InvalidOperationException("The specified modification type is unsupported for this constructor"); } }