internal virtual void AssignedProperty(Relationship rel, string key, object value, object valueBeforeTx) { valueBeforeTx = RemoveProperty(ExpectedRemovedRelationshipProperties, rel, key, valueBeforeTx); if (!value.Equals(valueBeforeTx)) { IDictionary <string, PropertyEntryImpl <Relationship> > map = ExpectedAssignedRelationshipProperties[rel]; PropertyEntryImpl <Relationship> prev = map[key]; map[key] = Property(rel, key, value, prev != null ? prev.PreviouslyCommitedValue() : valueBeforeTx); } }
internal virtual void AssignedProperty(Node node, string key, object value, object valueBeforeTx) { valueBeforeTx = RemoveProperty(ExpectedRemovedNodeProperties, node, key, valueBeforeTx); if (!value.Equals(valueBeforeTx)) { IDictionary <string, PropertyEntryImpl <Node> > map = ExpectedAssignedNodeProperties[node]; PropertyEntryImpl <Node> prev = map[key]; map[key] = Property(node, key, value, prev != null ? prev.PreviouslyCommitedValue() : valueBeforeTx); } }
/// <returns> {@code non-null} if this property should be expected to come as removed property in the event </returns> private object RemoveProperty <E>(IDictionary <E, IDictionary <string, PropertyEntryImpl <E> > > map, E entity, string key, object valueBeforeTx) where E : Org.Neo4j.Graphdb.PropertyContainer { if (map.ContainsKey(entity)) { IDictionary <string, PropertyEntryImpl <E> > inner = map[entity]; PropertyEntryImpl <E> entry = inner.Remove(key); if (entry == null) { // this means that we've been called to remove an existing property return(valueBeforeTx); } if (inner.Count == 0) { map.Remove(entity); } if (entry.PreviouslyCommitedValue() != null) { // this means that we're removing a previously changed property, i.e. there's a value to remove return(entry.PreviouslyCommitedValue()); } return(null); } return(valueBeforeTx); }