internal void SaveDataToXso(StoreObject storeObject, ReadOnlyCollection <XsoDriverPropertyDefinition> ignoredProperties) { if (storeObject == null) { throw new ArgumentNullException("storeObject"); } foreach (PropertyDefinition propertyDefinition in this.Schema.AllProperties) { if (propertyDefinition is XsoDriverPropertyDefinition) { XsoDriverPropertyDefinition xsoDriverPropertyDefinition = (XsoDriverPropertyDefinition)propertyDefinition; if (!xsoDriverPropertyDefinition.IsReadOnly && (ignoredProperties == null || !ignoredProperties.Contains(xsoDriverPropertyDefinition)) && (PropertyFlags.ReadOnly & xsoDriverPropertyDefinition.StorePropertyDefinition.PropertyFlags) == PropertyFlags.None && base.IsChanged(xsoDriverPropertyDefinition)) { object obj = null; this.propertyBag.TryGetField((ProviderPropertyDefinition)propertyDefinition, ref obj); if (obj != null) { storeObject[xsoDriverPropertyDefinition.StorePropertyDefinition] = obj; } else { storeObject.Delete(xsoDriverPropertyDefinition.StorePropertyDefinition); } } } } }
public override bool Equals(ProviderPropertyDefinition other) { if (object.ReferenceEquals(other, this)) { return(true); } XsoDriverPropertyDefinition xsoDriverPropertyDefinition = other as XsoDriverPropertyDefinition; return(xsoDriverPropertyDefinition != null && object.Equals(this.InitialValue, xsoDriverPropertyDefinition.InitialValue) && this.StorePropertyDefinition.CompareTo(xsoDriverPropertyDefinition.StorePropertyDefinition) == 0 && base.Equals(other)); }
public XsoMailboxConfigurationObjectSchema() { this.xsoPropertyMappings = new Dictionary <PropertyDefinition, XsoDriverPropertyDefinition>(); foreach (PropertyDefinition propertyDefinition in base.AllProperties) { XsoDriverPropertyDefinition xsoDriverPropertyDefinition = propertyDefinition as XsoDriverPropertyDefinition; if (xsoDriverPropertyDefinition != null) { if (this.xsoPropertyMappings.ContainsKey(xsoDriverPropertyDefinition.StorePropertyDefinition)) { throw new NotSupportedException("One XSO property is mapping to multiple XSO driver property."); } this.xsoPropertyMappings[xsoDriverPropertyDefinition.StorePropertyDefinition] = xsoDriverPropertyDefinition; } } this.cachedXsoProperties = this.xsoPropertyMappings.Keys.ToArray <PropertyDefinition>(); }
internal void LoadDataFromXsoRows(ADObjectId mailboxOwnerId, object[] objectRow, PropertyDefinition[] xsoPropertyDefinitions) { if (mailboxOwnerId == null) { throw new ArgumentNullException("mailboxOwnerId"); } if (objectRow == null) { throw new ArgumentNullException("objectRow"); } if (xsoPropertyDefinitions == null) { throw new ArgumentNullException("xsoPropertyDefinitions"); } if (objectRow.Length != xsoPropertyDefinitions.Length) { throw new ArgumentException("xsoPropertyDefinitions and objectRow length mismatch"); } base.InstantiationErrors.Clear(); this.MailboxOwnerId = mailboxOwnerId; for (int i = 0; i < xsoPropertyDefinitions.Length; i++) { XsoDriverPropertyDefinition relatedWrapperProperty = this.Schema.GetRelatedWrapperProperty(xsoPropertyDefinitions[i]); try { object obj = objectRow[i]; StorePropertyDefinition propertyDefinition = InternalSchema.ToStorePropertyDefinition(xsoPropertyDefinitions[i]); if (obj != null) { this.propertyBag.SetField(relatedWrapperProperty, PropertyBag.CheckPropertyValue <object>(propertyDefinition, obj, null)); } } catch (StoragePermanentException ex) { base.InstantiationErrors.Add(new PropertyValidationError(ex.LocalizedString, relatedWrapperProperty, null)); } } }
public XsoDriverPropertyDefinition(StorePropertyDefinition storePropertyDefinition, string name, ExchangeObjectVersion versionAdded, PropertyDefinitionFlags flags, object defaultValue, object initialValue, PropertyDefinitionConstraint[] readConstraints, PropertyDefinitionConstraint[] writeConstraints) : base(name, versionAdded, XsoDriverPropertyDefinition.WrapValueTypeByNullable(storePropertyDefinition.Type), flags, defaultValue, readConstraints, XsoDriverPropertyDefinition.MergeWithXsoConstraints(writeConstraints, storePropertyDefinition)) { this.InitialValue = initialValue; this.StorePropertyDefinition = storePropertyDefinition; }