I have run into some problems with serialization which I have never seen before. I am aware that multiple methods of serialization exist (binary, XML).
My root need is to find something to replace the forms coding of:
Control.Tag = Object
with the same logic in the world of ASP.NET. My plan of attack was to serialize the object and put that value in the "Value" of the related ASP.NET control. Thus when the user selects the given ASP.NET control you get a Serialized value denoting the object selected.
I first tried to use Binary Formatted Serialization however this proved unreliable as this method serialized both private and public properities. This caused conflicts with items which were not serializable.
My project in question contains a series of webpages along with several datalayer business objects. One of the the business objects has a method for serialization which has proven reliable for years.
A method exists which serializes via:
String SerialXML = SerialXML.Serialize<T>(ObjectValue);
Deserialization occurs via:
T ObjectValue = SerialXML.Deserialize<T>(SerialXML);
The problems I am seeing appear to be two fold. Objects created on a given webpages code behind page cannot be serialized/deserialized by the business layer. I get errors messages which imply that type "A" cannot be cast as "B" even though they are the same object. The location the objects were created seems to be the source of the problem. By this I mean that if Object "A" is created on page "X" and object "B" is created inside the business layer dll "Y", they are not considered to be the same type despite the fact that they are.
My second problem consists of ENUM's. Several of the business layer objects have ENUM's which have previously serialized without issue. When run within the ASP.NET world these values suddenly appear to be non-serializable. I get error messages which imply that the values are either duplicate values, which is incorrect, or that they could not be reflected.
Can anyone give me some suggestions on ways to overcome this serialization trouble? I would hate to have to write custom serialization/deserialization logic for each business object as there are hundreds of such objects. I suspect I am missing something obvious.
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.