//[OnDeserialized] //private void OnDeserialized(StreamingContext context) //{ // RebindEvents(); //} protected virtual void ChildCollectionChanged(object?sender, NotifyCollectionChangedEventArgs args) { string?propertyName = AttributeManager <NotifyCollectionChangedAttribute> .FindPropertyName(this, sender !); if (propertyName != null) { NotifyPrivate(propertyName); } if (AttributeManager <NotifyChildPropertyAttribute> .FieldsWithAttribute(this).Contains(sender)) { if (args.NewItems != null) { foreach (var p in args.NewItems.Cast <ModifiableEntity>()) { p.SetParentEntity(this); } } if (args.OldItems != null) { foreach (var p in args.OldItems.Cast <ModifiableEntity>()) { p.SetParentEntity(this); } } } }