MobileBindingList.OnSetChilderen() Deserialization/RaiseListChangedEvents

MobileBindingList.OnSetChilderen() Deserialization/RaiseListChangedEvents

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


Peran posted on Thursday, June 21, 2012

Hi Rocky/Jonny,

I'm using the recommended practice of using SuppressListChangedEvents in my ObjectFactory when loading data from my DB into a BusinessListBase/ReadOnlyListBase.

I was surprised to notice that when the object is deserialized on the client the same pattern is not followed, an event is raised for every item added to the collection during deserialization (MobileBindingList.OnSetChilderen() when deserializing $list).  Is this behavior expected?  I think it would also impact n level undo?

For my case I added a workaround to my BusinessListBase/ReadOnlyListBase base classes:

 

protected override void OnSetChildren(Csla.Serialization.Mobile.SerializationInfo info, Csla.Serialization.Mobile.MobileFormatter formatter)

{

    // prevent list change events whilst deserializing

    using (this.SuppressListChangedEvents)

    {

         base.OnSetChildren(info, formatter);

    }

}

 

If the behavior is not expected I can investigate a suitable fix within csla.

What do you think?

 

Peran

 

RockfordLhotka replied on Thursday, June 21, 2012

Peran,

It is not expected, but it is a known bug. I believe there's already an issue for this, and if you'd like to dig into it that'd be great!

Peran replied on Monday, June 25, 2012

Ok, I'll have a look into it.

 

Peran

 

Copyright (c) Marimer LLC