We want to use Sql Server session state, but we have already designed many of our objects to be serialized through WCF which uses the DataContractSerializer. I don't know what serializer the Sql Server session state uses but if it's the XmlSerializer then I'm afraid it might not work with the way our objects are designed.
Does anyone know which serializer it uses and if it can be changed?
Doesn't look like it can be changed. See this info from MSDN.
To perform data serialization and deserialization, ASP.NET uses two methods depending on the types involved. For basic types, ASP.NET resorts to an optimized internal serializer; for other types, including objects and user-defined classes, ASP.NET makes use of the .NET binary formatter. Basic types are String, DateTime, Boolean, byte, char, plus all numeric types. For these types, a tailor-made serializer is used that is faster than the default and general-purpose .NET binary formatter.
The optimized serializer is neither publicly available nor documented. It is nothing more than binary read/writer and employs a simple but effective storage schema. The serializer uses the BinaryWriter class to write out one byte to denote the type and then the value. While reading serialized bytes, the class first extracts one byte, detects the type of the data to read, and then resorts to a type-specific ReadXxx method on the BinaryReader class.
Doesn't look like it's serializing to XML. Just binary. Although note that was written in 2003, over a decade ago!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With