private static Dictionary<string, PropertyData> WriteExtendedProperties(PropertyChange propertyChange, EntityChangeType changeType)
		{
			var result = new Dictionary<string, PropertyData>();

			var collectionName = propertyChange.PropertyName;
			var oldColl = propertyChange.OldValue == null ? new Hashtable() : (IDictionary)propertyChange.OldValue;
			var newColl = propertyChange.NewValue == null ? new Hashtable() : (IDictionary)propertyChange.NewValue;

			// obtain unique set of keys over both items
			var keys = CollectionUtils.Unique(CollectionUtils.Concat(oldColl.Keys, newColl.Keys));

			// enumerate each key
			foreach (var key in keys)
			{
				var oldValue = oldColl.Contains(key) ? oldColl[key] : null;
				var newValue = newColl.Contains(key) ? newColl[key] : null;

				// has this "property" changed?
				if (!Equals(oldValue, newValue))
				{
					var propertyName = string.Concat(collectionName, ".", key);
					var propertyData = WriteProperty(oldValue, newValue, changeType);
					result.Add(propertyName, propertyData);
				}
			}
			return result;
		}
Beispiel #2
0
		/// <summary>
		/// Constructor
		/// </summary>
		public EntityChange(EntityRef entityRef, EntityChangeType changeType, PropertyChange[] propertyChanges)
		{
			_entityRef = entityRef;
			_changeType = changeType;
			_propertyChanges = propertyChanges;
		}