Delphi Component Serialization
Has anyone run into issues serializing components into a file and reading them back, specifically in the area where the component vendor upgrades the VCL components. For example a file serialized with DelphiX and then years later read back with delphiY. Do the serialization formats change and if so what can be done to prevent errors reading in the componets when upgrading.
Answer
The built-in RTTI based system for serializing published properties is vulnerable to changes in the components. Going forwards is manageable as long as old properties are kept in new objects. I.e. you leave the property interface as is, but can toss away the contents if you like. Going backwards is worse - as a newer version saved property can't be opened in older version load, and that will be a problem.
There are components / libs (http://www.torry.net/quicksearchd.php?String=RTTI&Title=Yes) that can add serialization in XML format and this may help a bit as you can choose to skip content you don't know.
You still need to be mindful about how you design your published content and should probably find a way to "ignore but propagate" content that your current version don't understand. This will allow you to open and change a file in a newer format while attempting to keep newer attributes, instead of stripping them.
Related Questions
- → Index out of range (-1) when I click on any item in the TListBox
- → How can I display only specified database results based on TListbox items?
- → SQL How to sum from another table and insert in another table
- → Can a Windows dll retrieve its own filename?
- → TObjectList<T>.IndexOf giving incorrect result
- → Add field to FDMemTable in Delphi
- → What impact (if any) does Delphi 2009's switch to Unicode(/UTF16) have on executable size and memory footprint?
- → How to solve Delphi's [Pascal Fatal Error] F2084 Internal Error: LA33?
- → Do I have to use Disable/EnableControls when using Locate in a TClientDataSet?
- → What is the best way to make a Delphi Application completely full screen?
- → Is it possible to get a delphi project to create a lib file as the output of the project?
- → How to get currently logged in username?
- → How to fix the endless printing loop bug in Nevrona Rave