private static void InitializeIncrementalAttributes(PolicyConfigurationBase baseConfiguration, IEnumerable <PropertyInfo> allProperties) { foreach (PropertyInfo propertyInfo in from p in allProperties where UnifiedPolicyStorageFactory.IsIncrementalAttribute(p) select p) { IncrementalAttributeBase incrementalAttribute = UnifiedPolicyStorageFactory.GetIncrementalAttribute(propertyInfo, false, null); propertyInfo.GetSetMethod().Invoke(baseConfiguration, new IncrementalAttributeBase[] { incrementalAttribute }); } foreach (PropertyInfo propertyInfo2 in from p in allProperties where UnifiedPolicyStorageFactory.IsIncrementalCollection(p) select p) { IncrementalAttributeBase incrementalCollection = UnifiedPolicyStorageFactory.GetIncrementalCollection(propertyInfo2, false, null, null); propertyInfo2.GetSetMethod().Invoke(baseConfiguration, new IncrementalAttributeBase[] { incrementalCollection }); } }
private static void CopyIncrementalCollection(PropertyInfo incrementalProperty, PropertyDefinition addedProperty, PropertyDefinition removedProperty, FacadeBase storage, PolicyConfigurationBase baseConfiguration) { object obj = null; object obj2 = null; UnifiedPolicyStorageFactory.TryReadPropertyValue(storage, addedProperty, out obj); UnifiedPolicyStorageFactory.TryReadPropertyValue(storage, removedProperty, out obj2); if (obj != null || obj2 != null) { IncrementalAttributeBase incrementalCollection = UnifiedPolicyStorageFactory.GetIncrementalCollection(incrementalProperty, true, (MultiValuedPropertyBase)obj, (MultiValuedPropertyBase)obj2); incrementalProperty.GetSetMethod().Invoke(baseConfiguration, new IncrementalAttributeBase[] { incrementalCollection }); } }
private static void CopyPropertyToStorage(PropertyDefinition schemaProperty, PropertyInfo property, IPropertyBag storage, PolicyConfigurationBase baseConfiguration) { object obj = property.GetGetMethod().Invoke(baseConfiguration, null); if (UnifiedPolicyStorageFactory.IsIncrementalAttribute(property) || UnifiedPolicyStorageFactory.IsIncrementalCollection(property)) { IncrementalAttributeBase incrementalAttributeBase = (IncrementalAttributeBase)obj; if (incrementalAttributeBase != null && incrementalAttributeBase.Changed) { UnifiedPolicyStorageFactory.StoreValue(storage, schemaProperty, incrementalAttributeBase.GetObjectValue()); return; } } else { UnifiedPolicyStorageFactory.StoreValue(storage, schemaProperty, obj); } }
private static void CopyPropertyFromStorage(PropertyInfo property, object propertyValue, PolicyConfigurationBase baseConfiguration) { if (UnifiedPolicyStorageFactory.IsIncrementalAttribute(property)) { IncrementalAttributeBase incrementalAttribute = UnifiedPolicyStorageFactory.GetIncrementalAttribute(property, true, propertyValue); property.GetSetMethod().Invoke(baseConfiguration, new IncrementalAttributeBase[] { incrementalAttribute }); return; } property.GetSetMethod().Invoke(baseConfiguration, new object[] { propertyValue }); }