Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1357


Ignore:
Timestamp:
03/18/09 18:13:40 (16 years ago)
Author:
epitzer
Message:

Pluginification and major refactoring. (#506)

Location:
branches/New Persistence Exploration/Persistence
Files:
11 added
4 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • branches/New Persistence Exploration/Persistence/Persistence.sln

    r1338 r1357  
    22Microsoft Visual Studio Solution File, Format Version 10.00
    33# Visual Studio 2008
    4 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Persistence", "Persistence\Persistence.csproj", "{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}"
     4Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Persistence", "Persistence\HeuristicLab.Persistence.csproj", "{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}"
    55EndProject
    6 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{E2245078-6F40-449E-A370-01A97A7C5E6A}"
     6Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Persistence.Test", "Test\HeuristicLab.Persistence.Test.csproj", "{E2245078-6F40-449E-A370-01A97A7C5E6A}"
     7EndProject
     8Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.PluginInfrastructure", "..\..\..\trunk\sources\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj", "{94186A6A-5176-4402-AE83-886557B53CCA}"
    79EndProject
    810Global
     
    2628    {E2245078-6F40-449E-A370-01A97A7C5E6A}.Release|Any CPU.Build.0 = Release|Any CPU
    2729    {E2245078-6F40-449E-A370-01A97A7C5E6A}.Release|x86.ActiveCfg = Release|Any CPU
     30    {94186A6A-5176-4402-AE83-886557B53CCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     31    {94186A6A-5176-4402-AE83-886557B53CCA}.Debug|Any CPU.Build.0 = Debug|Any CPU
     32    {94186A6A-5176-4402-AE83-886557B53CCA}.Debug|x86.ActiveCfg = Debug|x86
     33    {94186A6A-5176-4402-AE83-886557B53CCA}.Debug|x86.Build.0 = Debug|x86
     34    {94186A6A-5176-4402-AE83-886557B53CCA}.Release|Any CPU.ActiveCfg = Release|Any CPU
     35    {94186A6A-5176-4402-AE83-886557B53CCA}.Release|Any CPU.Build.0 = Release|Any CPU
     36    {94186A6A-5176-4402-AE83-886557B53CCA}.Release|x86.ActiveCfg = Release|x86
     37    {94186A6A-5176-4402-AE83-886557B53CCA}.Release|x86.Build.0 = Release|x86
    2838  EndGlobalSection
    2939  GlobalSection(SolutionProperties) = preSolution
  • branches/New Persistence Exploration/Persistence/Persistence/DeSerializer.cs

    r1356 r1357  
    11using System.Collections.Generic;
    22using System;
     3using HeuristicLab.Persistence.Interfaces;
    34
    4 namespace Persistence {
     5namespace HeuristicLab.Persistence {
     6
     7
     8  struct ParentReference { }
     9  delegate void Setter(object value);
     10
     11
     12  interface IAccessibleObject {
     13    object Obj { get; }
     14    Setter GetSetter(string name);
     15  }
     16
     17
     18  class CustomObject : IAccessibleObject {
     19
     20    public object Obj { get; private set; }
     21    public readonly List<object> customValues;
     22
     23    public CustomObject(object obj) {
     24      Obj = obj;
     25      customValues = new List<object>();
     26    }
     27
     28    public void AddValue(object value) {
     29      customValues.Add(value);
     30    }
     31
     32    public Setter GetSetter(string name) {
     33      int index = customValues.Count - 1;
     34      return value => customValues[index] = value;
     35    }
     36  }
     37
     38
     39  class CompositeObject : IAccessibleObject {
     40
     41    public object Obj { get; private set; }
     42    public readonly Dictionary<string, DataMemberAccessor> accessorDict;
     43
     44    public CompositeObject(object obj, Dictionary<string, DataMemberAccessor> accessorDict) {
     45      Obj = obj;
     46      this.accessorDict = new Dictionary<string, DataMemberAccessor>();
     47      foreach (KeyValuePair<string, DataMemberAccessor> pair in accessorDict) {
     48        this.accessorDict.Add(
     49          pair.Value.Name,
     50          pair.Value);
     51      }
     52    }
     53
     54    public void SetValue(string name, object value) {
     55      accessorDict[name].Set(value);
     56      accessorDict.Remove(name);
     57    }
     58
     59    public Setter GetSetter(string name) {
     60      return value => accessorDict[name].Set(value);
     61    }
     62
     63    public void PopulateDefaultValues() {
     64      foreach (var pair in accessorDict) {
     65        pair.Value.Set(pair.Value.DefaultValue);
     66      }
     67    }
     68  }
     69
    570
    671  public class DeSerializer {
    772
    8     struct ParentReference { }
    9 
    10     delegate void Setter(object value);
    11 
    12     interface IAccessibleObject {
    13       object Obj { get; }     
    14       Setter GetSetter(string name);
    15     }
    16 
    17     class CustomObject : IAccessibleObject {
    18       public object Obj { get; private set; }
    19       public readonly List<object> customValues;
    20       public CustomObject(object obj) {
    21         Obj = obj;
    22         customValues = new List<object>();
    23       }
    24       public void AddValue(object value) {
    25         customValues.Add(value);
    26       }
    27       public Setter GetSetter(string name) {
    28         int index = customValues.Count-1;
    29         return value => customValues[index] = value;
    30       }
    31     }
    32 
    33     class CompositeObject : IAccessibleObject {
    34       public object Obj { get; private set; }
    35       public readonly Dictionary<string, DataMemberAccessor> accessorDict;
    36       public CompositeObject(object obj, Dictionary<string, DataMemberAccessor> accessorDict) {
    37         Obj = obj;
    38         this.accessorDict = new Dictionary<string, DataMemberAccessor>();
    39         foreach (KeyValuePair<string, DataMemberAccessor> pair in accessorDict) {
    40           this.accessorDict.Add(
    41             pair.Value.Name,
    42             pair.Value);
    43         }
    44       }
    45       public void SetValue(string name, object value) {
    46         accessorDict[name].Set(value);
    47         accessorDict.Remove(name);
    48       }
    49       public Setter GetSetter(string name) {
    50         return value => accessorDict[name].Set(value);
    51       }
    52       public void PopulateDefaultValues() {
    53         foreach (var pair in accessorDict) {
    54           pair.Value.Set(pair.Value.DefaultValue);
    55         }       
    56       }
    57     }
    58 
    5973    private delegate void Handler(ISerializationToken token);
     74    private delegate void Thunk();
    6075
    6176    private readonly Dictionary<int, object> id2obj;
     
    6378    private readonly Stack<IAccessibleObject> compositeStack;
    6479    private readonly PersistenceConfiguration persistenceConfiguration;
    65     private readonly Dictionary<int, Type> typeIds;
    66 
    67     delegate void Thunk();
     80    private readonly Dictionary<int, Type> typeIds;   
    6881    private List<Thunk> finalFixes;
    6982
     
    115128        id2obj.Add((int)start.Id, instance);
    116129    }
     130
    117131    private void CompositeEndHandler(ISerializationToken token) {
    118132      EndToken end = (EndToken)token;
     
    132146      }
    133147    }
     148
    134149    private void PrimitiveHandler(ISerializationToken token) {
    135150      PrimitiveToken primitive = (PrimitiveToken)token;
     
    142157      SetValue(primitive.Name, value);
    143158    }
     159
    144160    private void ReferenceHandler(ISerializationToken token) {
    145161      ReferenceToken reference = (ReferenceToken)token;
     
    152168      }
    153169    }
     170
    154171    private void NullHandler(ISerializationToken token) {
    155172      NullReferenceToken nil = (NullReferenceToken)token;
    156173      SetValue(nil.Name, null);
    157174    }
     175
    158176    private void SetValue(string name, object value) {
    159177      if (compositeStack.Count == 0) {
  • branches/New Persistence Exploration/Persistence/Persistence/Decomposers.cs

    r1354 r1357  
    33using System.Reflection;
    44using System.Collections.Generic;
    5 namespace Persistence {
     5using HeuristicLab.Persistence.Interfaces;
     6
     7namespace HeuristicLab.Persistence {
    68 
    7 
    8   public interface IDecomposer {
    9     bool CanSerialize(Type type);
    10     IEnumerable Serialize(object obj);
    11     object DeSerialize(IEnumerable objects, Type type);
    12   }
    13 
    14 
    159  public class EnumerableDecomposer : IDecomposer {
    1610
  • branches/New Persistence Exploration/Persistence/Persistence/PersistenceConfiguration.cs

    r1349 r1357  
    22using System.Collections.Generic;
    33using System.Reflection;
     4using HeuristicLab.Persistence.Interfaces;
    45
    5 namespace Persistence {
     6namespace HeuristicLab.Persistence {
    67
    78  public class PersistenceConfiguration {
  • branches/New Persistence Exploration/Persistence/Persistence/PrimitiveFormatters.cs

    r1348 r1357  
    11using System;
    2 using System.Collections;
    3 using System.Collections.Generic;
    42using System.Text;
    53using System.Globalization;
    6 namespace Persistence {
     4using HeuristicLab.Persistence.Interfaces;
    75
    8   public interface IFormat {
    9     string Name { get; }
    10   }
    11 
    12   public interface IFormatter {
    13     Type Type { get; }
    14     IFormat Format { get; }
    15     object Serialize(object o);
    16     object DeSerialize(object o);
    17   }
     6namespace HeuristicLab.Persistence {
    187
    198  public class XmlFormat : IFormat {
     
    8574  }
    8675
    87   public abstract class NumberArray2XmlFormatter : IFormatter {
    88     public abstract Type Type { get; }
    89     public IFormat Format { get { return XmlFormat.Instance; } }
    90     protected virtual string Separator { get { return ";"; } }
    91     protected abstract string formatValue(object o);
    92     protected abstract object parseValue(string o);
    93     public object Serialize(object obj) {     
    94       Array a = (Array)obj;
    95       StringBuilder sb = new StringBuilder();
    96       sb.Append(a.Rank);     
    97       for (int i = 0; i < a.Rank; i++) {
    98         sb.Append(Separator);
    99         sb.Append(a.GetLength(i));
    100       }
    101       foreach (object o in a) {
    102         sb.Append(Separator);
    103         sb.Append(formatValue(o));
    104       }
    105       return sb.ToString();
    106     }
    107     public object DeSerialize(object o) {
    108       IEnumerator values =
    109         ((string) o)
    110         .Split(new[] {Separator},
    111         StringSplitOptions.RemoveEmptyEntries).GetEnumerator();
    112       values.MoveNext();
    113       int rank = int.Parse((string)values.Current);
    114       int[] lengths = new int[rank];
    115       for ( int i = 0; i<rank; i++ ) {
    116         values.MoveNext();
    117         lengths[i] = int.Parse((string)values.Current);
    118       }
    119       Array a = Array.CreateInstance(this.Type.GetElementType(), lengths);
    120       int[] positions = new int[rank];
    121       while ( values.MoveNext() ) {
    122         a.SetValue(parseValue((string)values.Current), positions);
    123         positions[0] += 1;
    124         for ( int i = 0; i<rank-1; i++) {
    125           if (positions[i] >= lengths[i]) {
    126             positions[i] = 0;
    127             positions[i + 1] += 1;
    128           } else {
    129             break;
    130           }
    131         }
    132       }
    133       return a;
    134     }
    135   }
    136   public class IntArray2XmlFormatter : NumberArray2XmlFormatter {
    137     public override Type Type { get { return typeof(int[]); } }
    138     protected override string formatValue(object o) { return o.ToString(); }
    139     protected override object parseValue(string o) { return int.Parse(o); }
    140   }
    141   public class Int2DArray2XmlFormatter : IntArray2XmlFormatter {
    142     public override Type Type { get { return typeof (int[,]); } }
    143   }
    144   public class Int3DArray2XmlFormatter : IntArray2XmlFormatter {
    145     public override Type Type { get { return typeof(int[,,]); } }
    146   }
    147   public class DoubleArray2XmlFormatter : NumberArray2XmlFormatter {
    148     public override Type Type { get { return typeof(double[]); } }
    149     protected override string formatValue(object o) { return ((double) o).ToString("r"); }
    150     protected override object parseValue(string o) { return double.Parse(o); }   
    151   }
    152   public class Double2DArray2XmlFormatter : DoubleArray2XmlFormatter {
    153     public override Type Type { get { return typeof(double[,]); } }   
    154   }
    155   public class Double3DArray2XmlFormatter : DoubleArray2XmlFormatter {
    156     public override Type Type { get { return typeof(double[,,]); } }
    157   }
    158 
    159   public abstract class NumberEnumeration2XmlFormatter : IFormatter {
    160     public abstract Type Type { get; }
    161     public IFormat Format { get { return XmlFormat.Instance; } }
    162     protected virtual string Separator { get { return ";"; } }
    163     protected abstract void Add(IEnumerable enumeration, object o);
    164     protected abstract object Instantiate();
    165     protected abstract string formatValue(object o);
    166     protected abstract object parseValue(string o);   
    167     public object Serialize(object o) {
    168       StringBuilder sb = new StringBuilder();
    169       foreach (var value in (IEnumerable) o) {       
    170         sb.Append(formatValue(value));
    171         sb.Append(Separator);
    172       }
    173       return sb.ToString();
    174     } 
    175     public object DeSerialize(object o) {
    176       IEnumerable enumeration = (IEnumerable) Instantiate();       
    177       string[] values = ((string) o).Split(new[] {Separator}, StringSplitOptions.RemoveEmptyEntries);
    178       foreach ( var value in values ) {
    179         Add(enumeration, parseValue(value));
    180       }
    181       return enumeration;
    182     }
    183   }
    184   public class IntList2XmlFormatter : NumberEnumeration2XmlFormatter {
    185     public override Type Type { get { return typeof(List<int>); } }
    186     protected override void Add(IEnumerable enumeration, object o) { ((List<int>)enumeration).Add((int)o); }
    187     protected override object Instantiate() { return new List<int>(); }
    188     protected override string formatValue(object o) { return o.ToString(); }
    189     protected override object parseValue(string o) { return int.Parse(o); }
    190   } 
    191   public class DoubleList2XmlFormatter : NumberEnumeration2XmlFormatter {
    192     public override Type Type { get { return typeof(List<double>); } }
    193     protected override void Add(IEnumerable enumeration, object o) { ((List<double>)enumeration).Add((int)o); }
    194     protected override object Instantiate() { return new List<double>(); }
    195     protected override string formatValue(object o) { return ((double) o).ToString("r"); }
    196     protected override object parseValue(string o) { return double.Parse(o); }
    197   }
     76 
    19877}
  • branches/New Persistence Exploration/Persistence/Persistence/Serializer.cs

    r1356 r1357  
    33using System;
    44using System.Linq;
     5using HeuristicLab.Persistence.Interfaces;
    56
    6 namespace Persistence {
     7namespace HeuristicLab.Persistence {
    78
    89  public class Serializer : IEnumerable<ISerializationToken> {
     
    4647    }
    4748
     49   
    4850    private IEnumerator<ISerializationToken> Serialize(DataMemberAccessor accessor) {
    49 
    5051      object value = accessor.Get();
    51 
    52       if (value == null) {
    53         yield return new NullReferenceToken(accessor.Name);
    54         yield break;
    55       }
    56 
    57       if (obj2id.ContainsKey(value)) {
    58         yield return new ReferenceToken(accessor.Name, obj2id[value]);
    59         yield break;
    60       }
    61      
     52      if (value == null)
     53        return NullReferenceEnumeration(accessor.Name);
     54      if (obj2id.ContainsKey(value))
     55        return ReferenceTokenEnumeration(accessor.Name, obj2id[value]);             
    6256      if ( ! typeCache.ContainsKey(value.GetType()))
    6357        typeCache.Add(value.GetType(), typeCache.Count);
    6458      int typeId = typeCache[value.GetType()];
    65 
    6659      int? id = null;
    6760      if ( ! value.GetType().IsValueType) {
     
    6962        obj2id.Add(value, (int)id);
    7063      }
     64      IFormatter formatter = persistenceConfiguration.GetFormatter(XmlFormat.Instance, value.GetType());
     65      if (formatter != null)
     66        return PrimitiveEnumeration(accessor.Name, typeId, formatter.Serialize(value), id);
     67      IDecomposer decomposer = persistenceConfiguration.GetDecomposer(value.GetType());
     68      if (decomposer != null)
     69        return CompositeEnumeration(accessor.Name, decomposer.Serialize(value), id, typeId);           
     70      return StorableEnumeration(accessor.Name, value, id, typeId);
     71    }
    7172
    72       IFormatter formatter = persistenceConfiguration.GetFormatter(XmlFormat.Instance, value.GetType());     
    73       if (formatter != null) {
    74         yield return new PrimitiveToken(
    75           accessor.Name,
    76           typeId,
    77           formatter.Serialize(value),         
    78           id);
    79         yield break;
    80       }
    81      
    82       yield return new BeginToken(accessor.Name, typeId, id);
    83       IDecomposer decomposer = persistenceConfiguration.GetDecomposer(value.GetType());     
     73    private IEnumerator<ISerializationToken> NullReferenceEnumeration(string name) {
     74      yield return new NullReferenceToken(name);
     75    }
    8476
    85       if (decomposer != null) {
    86         foreach (object o in decomposer.Serialize(value)) {
     77    private IEnumerator<ISerializationToken> ReferenceTokenEnumeration(string name, int id) {
     78      yield return new ReferenceToken(name, id);
     79    }
     80
     81    private IEnumerator<ISerializationToken> PrimitiveEnumeration(string name, int typeId, object serializedValue, int? id) {
     82      yield return new PrimitiveToken(name, typeId, serializedValue, id);
     83    }
     84
     85    private IEnumerator<ISerializationToken> CompositeEnumeration(string name, IEnumerable values, int? id, int typeId) {
     86      yield return new BeginToken(name, typeId, id);     
     87        foreach (object o in values) {
    8788          IEnumerator<ISerializationToken> iterator = Serialize(new DataMemberAccessor(o));
    8889          while (iterator.MoveNext())
    8990            yield return iterator.Current;
    9091        }
    91         yield return new EndToken(accessor.Name, typeId, id);
    92         yield break;
    93       }
     92      yield return new EndToken(name, typeId, id);       
     93    }
    9494
     95    private IEnumerator<ISerializationToken> StorableEnumeration(string name, object value, int? id, int typeId) {           
     96      yield return new BeginToken(name, typeId, id);
    9597      int nSubComponents = 0;
    9698      foreach (KeyValuePair<string, DataMemberAccessor> mapping in
     
    107109                                         value.GetType().FullName));
    108110      }
    109       yield return new EndToken(accessor.Name, typeId, id);
     111      yield return new EndToken(name, typeId, id);
    110112    }
    111    
    112113  }
     114
     115
    113116}
  • branches/New Persistence Exploration/Persistence/Persistence/StorableAttribute.cs

    r1348 r1357  
    33using System.Reflection;
    44using System.Linq;
    5 
    6 namespace Persistence {
     5using HeuristicLab.Persistence.Interfaces;
     6
     7namespace HeuristicLab.Persistence {
    78
    89  [AttributeUsage(
  • branches/New Persistence Exploration/Persistence/Persistence/Util.cs

    r1329 r1357  
    44using System.Reflection;
    55
    6 namespace Persistence { 
     6namespace HeuristicLab.Persistence { 
     7
    78  public class InterfaceInstantiatior {
    89    public static List<T> InstantiateAll<T>() {
  • branches/New Persistence Exploration/Persistence/Persistence/XmlFormatter.cs

    r1355 r1357  
    22using System;
    33using System.Text;
    4 namespace Persistence {
     4using HeuristicLab.Persistence.Interfaces;
     5
     6namespace HeuristicLab.Persistence {
    57  public class XmlFormatter {
    68
  • branches/New Persistence Exploration/Persistence/Persistence/XmlParser.cs

    r1356 r1357  
    44using System.Collections;
    55using System.IO;
     6using HeuristicLab.Persistence.Interfaces;
    67
    7 namespace Persistence {
     8namespace HeuristicLab.Persistence {
    89
    910
  • branches/New Persistence Exploration/Persistence/Test/NewSerializationTest.cs

    r1356 r1357  
    11using System;
     2using System.Collections;
    23using System.Collections.Generic;
    34using System.IO;
    4 
    5 namespace Persistence.Test {
     5using HeuristicLab.Persistence.Interfaces;
     6
     7namespace HeuristicLab.Persistence.Test {
     8
     9  public class RootBase {
     10    [Storable]
     11    private string baseString = "Serial";
     12  }
     13
     14  public class Root : RootBase {
     15    [Storable]
     16    public int[] i = new[] { 3, 4, 5, 6 };
     17    [Storable]
     18    public string s;
     19    [Storable]
     20    public ArrayList intArray = new ArrayList(new[] { 1, 2, 3 });
     21    [Storable]
     22    public List<int> intList = new List<int>(new[] { 321, 312, 321 });
     23    [Storable]
     24    public Custom c;
     25    [Storable]
     26    public List<Root> selfReferences;
     27    [Storable]
     28    public double[,] multiDimArray = new double[,] { { 1, 2, 3 }, { 3, 4, 5 } };
     29    [Storable]
     30    public bool boolean = true;
     31    [Storable]
     32    public DateTime dateTime;
     33    [Storable]
     34    public KeyValuePair<string, int> kvp = new KeyValuePair<string, int>("Serial", 123);
     35    [Storable]
     36    public Dictionary<string, int> dict = new Dictionary<string, int>();
     37    [Storable(DefaultValue = "default")]
     38    public string uninitialized;
     39  }
     40
     41  public class Custom {
     42    [Storable]
     43    public int i;
     44    [Storable]
     45    public Root r;
     46    [Storable]
     47    public string name = "Serial";
     48  }
     49
     50  public class CloneableRoot {
     51    public int[] i = new[] { 3, 4, 5, 6 };
     52    public string s;
     53    public ArrayList intArray = new ArrayList(new[] { 1, 2, 3 });
     54    public List<int> intList = new List<int>(new[] { 321, 312, 321 });
     55    public CloneableCustom c;
     56    public List<CloneableRoot> selfReferences;
     57    public double[,] multiDimArray = new double[,] { { 1, 2, 3 }, { 3, 4, 5 } };
     58    public bool boolean = true;
     59    public DateTime dateTime;
     60    public KeyValuePair<string, int> kvp = new KeyValuePair<string, int>("test key", 123);
     61    public Dictionary<string, int> dict = new Dictionary<string, int>();
     62    public object Clone(Dictionary<object, object> twins) {
     63      if (twins.ContainsKey(this))
     64        return twins[this];
     65      CloneableRoot cr = new CloneableRoot();
     66      twins.Add(this, cr);
     67      cr.i = i;
     68      cr.s = s;
     69      cr.intArray = new ArrayList(intArray);
     70      cr.intList = new List<int>(intList);
     71      cr.c = (CloneableCustom)c.Clone(twins);
     72      cr.selfReferences = new List<CloneableRoot>();
     73      for (int j = 0; j < selfReferences.Count; j++) {
     74        cr.selfReferences.Add(this);
     75      }
     76      cr.multiDimArray = (double[,])multiDimArray.Clone();
     77      cr.dateTime = new DateTime(dateTime.Ticks);
     78      cr.kvp = new KeyValuePair<string, int>(kvp.Key, kvp.Value);
     79      cr.dict = new Dictionary<string, int>(dict);
     80      return cr;
     81    }
     82  }
     83
     84  public class CloneableCustom {
     85    public int i;
     86    public CloneableRoot r;
     87    public string name = "Serial";
     88    public object Clone(Dictionary<object, object> twins) {
     89      if (twins.ContainsKey(this))
     90        return twins[this];
     91      CloneableCustom cc = new CloneableCustom();
     92      twins.Add(this, cc);
     93      cc.i = i;
     94      cc.r = (CloneableRoot)r.Clone(twins);
     95      cc.name = name;
     96      return cc;
     97    }
     98  }
     99
     100  public class Manager {
     101
     102    private DateTime lastLoadTime;
     103    [Storable]
     104    private DateTime lastLoadTimePersistence {
     105      get { return lastLoadTime; }
     106      // ReSharper disable ValueParameterNotUsed
     107      set { lastLoadTime = DateTime.Now; }
     108      // ReSharper restore ValueParameterNotUsed
     109    }
     110    [Storable]
     111    private double? dbl;
     112  }
     113
     114  public class StorableObject {
     115
     116    [Storable]
     117    Dictionary<int, string> dict;
     118
     119    public void Init() {
     120      dict = new Dictionary<int, string>();
     121      for (int i = 0; i < 1000000; i++) {
     122        dict.Add(i, i.ToString());
     123      }
     124    }
     125  }
     126
     127  public class CloneableObject : ICloneable {
     128
     129    Dictionary<int, string> dict;
     130
     131    public void Init() {
     132      dict = new Dictionary<int, string>();
     133      for (int i = 0; i < 1000000; i++) {
     134        dict.Add(i, i.ToString());
     135      }
     136    }
     137    public object Clone() {
     138      CloneableObject clone = new CloneableObject {
     139        dict = new Dictionary<int, string>(dict)
     140      };
     141      return clone;
     142    }
     143  } 
    6144
    7145  public class NewSerializationTest {
Note: See TracChangeset for help on using the changeset viewer.