FilteredBindingList and Serialization errors with CLSA 2.0

FilteredBindingList and Serialization errors with CLSA 2.0

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


wjcomeaux posted on Friday, March 14, 2008

Hello all:

I have added a FilteredBindingList to on of my business objects. When I try to run my code I am now getting serialization errors because of the FilteredBindingList. School_ER and Student_EC are serializable. I've added the NonSerialized attribute to the private FilteredBindingList member to see if it would correct the issue but I still get the error.

The filtered list shouldn't be serialized, just the main list of students so the NonSerialized attribute seemed logical .

Basically I need a school object that manages ALL students. However, my user interface needs to see different lists of students (filtered by class). So I am creating a filtered binding list inside of school for which I can change the filter property as necessary and any controls it's bound to will show the proper subset of students.

At any time I only want a student object in memory once so I can't just instantiate a new list using a different filter.

Here is the actual error

"Type 'Csla.FilteredBindingList`1[[Business.Student_EC, Business, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' in Assembly 'Csla, Version=3.0.3.0, Culture=neutral, PublicKeyToken=93be5fdc093e4c30' is not marked as serializable."

 

Thanks,

Will

RockfordLhotka replied on Saturday, March 15, 2008

If you contain a FBL inside a business object you would need to mark it as NonSerialized and NotUndoable.

Fwiw, FBL is really designed to be created/used by the UI developer more than the business object developer.

wjcomeaux replied on Monday, March 17, 2008

Thanks Rocky:

Yes, I realize that is the intention of the FBL, however having it inside my BO for this particular scenario actually makes sense.

Thanks again,

Will

Copyright (c) Marimer LLC