Can a bug in EditableRootParent

Can a bug in EditableRootParent

Old forum URL: forums.lhotka.net/forums/t/3789.aspx


phucphlq posted on Friday, October 26, 2007

Hi all,

I use CSLA 3.0.2 070928, not use remote data host. I wrote EditableRootParent class, I tried to catch ListChangeEvent when childrenList is changed and call OnPropertyChanged

Ex:

private Project()

    {

      _resources = ProjectResources.NewProjectResources();

      _resources.ListChanged += new System.ComponentModel.ListChangedEventHandler(_resources_ListChanged);

    }

 

    void _resources_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)

    {

      OnPropertyChanged(null);

    }

 

At the first time fetch, _nonSerializableHandlers(member of BindableBase class) is not null. But when fetch EditableRootParent again, _nonSerializableHandlers is null and don’t raise event.

 [EditorBrowsable(EditorBrowsableState.Advanced)]
    protected virtual void OnPropertyChanged(string propertyName)
    {
      if (_nonSerializableHandlers != null) //Null at the second time fetch
        _nonSerializableHandlers.Invoke(this,
          new PropertyChangedEventArgs(propertyName));
      if (_serializableHandlers != null)
        _serializableHandlers.Invoke(this,
          new PropertyChangedEventArgs(propertyName));
    }

 

ajj3085 replied on Monday, October 29, 2007

Are you overriding OnDeserialized?  You'll need to do this to rehook any event handlers.

Copyright (c) Marimer LLC