serialize problem

serialize problem

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


pillesoft posted on Tuesday, September 23, 2008

Dear All,

i have created my objects without using CSLA base classes.
this application is intended to save its objects into locally into an XML file. (no need to manage sql server)

i have implemented a simple serialization, it worked well.
now i changed my class and inherited from BusinessBase.
and the serialization is failing.
BrokenRulesCollection cannot be serialized

any solution?
Ivan

JoeFallon1 replied on Tuesday, September 23, 2008

It is a well known fact that a CSLA BO cannot be serialized by the XML serializer.

You must use the binary serializer or derive your own method for saving the data.

Joe

 

pillesoft replied on Thursday, October 09, 2008

thanks Joe,

I tried to implement binary serialization and it is very good so far.
i have an auth object, which has username, and password properties.

i want username to serialize, but password not. i put NonSerialized attribute before password, but it is still saved in output file.

what can be wrong?

Ivan

JoeFallon1 replied on Thursday, October 09, 2008

" i put NonSerialized attribute before password"

Did you put it before the Property (wrong place)

or the Field? (right place)

Joe

 

pillesoft replied on Friday, October 10, 2008

thanks Joe,

i don't know what was the problem yesterday night (it's true it was too late)
of course i needed to change from property to field.

but when i checked today, the serialization works as expected.
username is serialized, and deserializing also, but the password needs to be entered always

thank you

Ivan

Copyright (c) Marimer LLC