Free cookie consent management tool by TermsFeed Policy Generator

Changes between Version 6 and Version 7 of Documentation/DevelopmentCenter/UsePersistence


Ignore:
Timestamp:
10/05/20 10:52:56 (4 years ago)
Author:
abeham
Comment:

updated with HL 3.3.16 new type

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/DevelopmentCenter/UsePersistence

    v6 v7  
    11= Quick guide: HeuristicLab persistence =
     2
     3In HeuristicLab 3.3.16 the persistence has been changed. Instead of using the previous XML-based serialization and deserialization a new binary format is used based on protocol buffers. The persistence is now also open sourced as a standalone project: [https://github.com/heal-research/HEAL.Attic HEAL.Attic].
     4
     5HeuristicLab 3.3.16 supports loading files in the XML format, but stores those in the new format when saved. Thus, it can be used to convert files from the old format to the new format. In order to use the new conversion you have to adapt any new types that you introduced to the new persistence.
    26
    37== Invocation ==
     
    913Content types that should be saved and restored have to be decorated with attributes.
    1014
    11  * Add the [StorableClass] attribute to a new class
     15 * Add the [StorableType("<INSERT GUID>")] attribute to a new class, interface, and enum.
    1216 * Add the [Storable] attribute to any fields or properties you would like to be persisted
    1317 * If the default constructor takes longer to initialize, persistence can be directed to use a different constructor by decorating it with the [StorableConstructor] attribute. This constructor has to have a single boolean parameter which will be set to true.
     
    1519{{{
    1620#!csharp
    17 [StorableClass]
     21[StorableType("00000000-0000-0000-0000-000000000000")]
    1822public class SomeClass : Item {
    1923  [Storable]
     
    2125
    2226  [StorableConstructor]
    23   protected SomeClass(bool deserializing) : base(deserializing) { }
     27  protected SomeClass(StorableConstructorFlag _) : base(_) { }
    2428  public SomeClass() {
    2529    // a lot of initialization code that should be skipped during deserialization
     
    3236{{{
    3337#!csharp
    34 [StorableClass]
     38[StorableType("00000000-0000-0000-0000-000000000000")]
    3539public class SomeClass {
    3640  ...