Changes between Version 6 and Version 7 of Documentation/DevelopmentCenter/UsePersistence
- Timestamp:
- 10/05/20 10:52:56 (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Documentation/DevelopmentCenter/UsePersistence
v6 v7 1 1 = Quick guide: HeuristicLab persistence = 2 3 In 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 5 HeuristicLab 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. 2 6 3 7 == Invocation == … … 9 13 Content types that should be saved and restored have to be decorated with attributes. 10 14 11 * Add the [Storable Class] attribute to a new class15 * Add the [StorableType("<INSERT GUID>")] attribute to a new class, interface, and enum. 12 16 * Add the [Storable] attribute to any fields or properties you would like to be persisted 13 17 * 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. … … 15 19 {{{ 16 20 #!csharp 17 [Storable Class]21 [StorableType("00000000-0000-0000-0000-000000000000")] 18 22 public class SomeClass : Item { 19 23 [Storable] … … 21 25 22 26 [StorableConstructor] 23 protected SomeClass( bool deserializing) : base(deserializing) { }27 protected SomeClass(StorableConstructorFlag _) : base(_) { } 24 28 public SomeClass() { 25 29 // a lot of initialization code that should be skipped during deserialization … … 32 36 {{{ 33 37 #!csharp 34 [Storable Class]38 [StorableType("00000000-0000-0000-0000-000000000000")] 35 39 public class SomeClass { 36 40 ...