//private bool IsContainedInHookChain(ChangeTrackingObject trackingObject) //{ // if (HookedObjects.Count == 0) // return false; // if (HookedObjects.Any(x => x.Value == trackingObject)) // return true; // foreach (var childObj in HookedObjects) // { // if (childObj.Value.IsContainedInHookChain(trackingObject)) // return true; // } // return false; //} private void AttachChildEvents(ChangeTrackingObject trackingObject, string propertyName = null) { var childHook = new ChildEventHook(propertyName, trackingObject); if (!HookedObjects.Contains(childHook)) { HookedObjects.Add(childHook); childHook.Attach(OnChildEventRaised); } }
private void DettachChildEvents(ChangeTrackingObject trackingObject) { trackingObject.PropertyValueChanging -= ChildObject_PropertyValueChanging; trackingObject.PropertyValueChanged -= ChildObject_PropertyValueChanged; trackingObject.ChildEventForwarded -= ChildObject_ChildEventForwarded; }
public ChildEventHook(string propertyName, ChangeTrackingObject value) { PropertyName = propertyName; Value = value; }
public ChangeTrackingCollection(ChangeTrackingObject trackingObject) { trackingObject.AttachCollection(this); }