Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/04/17 18:16:25 (8 years ago)
Author:
gkronber
Message:

#2520 added unit tests and fixed all test cases for old persistence

Location:
branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/EnumSerializer.cs

    r14927 r14928  
    3636
    3737    public int Priority {
    38       get { return 100; }
     38      get { return 205; } // higher than storabletype
    3939    }
    4040
  • branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableReflection.cs

    r14185 r14928  
    4343        storableMembers.AddRange(GenerateStorableMembers(type.BaseType));
    4444
    45       var storableClassAttribute = GetStorableClassAttribute(type);
    46       if (storableClassAttribute != null) {
    47         switch (storableClassAttribute.Type) {
    48           case StorableClassType.MarkedOnly:
     45      var storableTypeAttribute = GetStorableTypeAttribute(type);
     46      if (storableTypeAttribute != null) {
     47        switch (storableTypeAttribute.MemberSelection) {
     48          case StorableMemberSelection.MarkedOnly:
    4949            AddMarkedMembers(type, storableMembers); break;
    50           case StorableClassType.AllFields:
     50          case StorableMemberSelection.AllFields:
    5151            AddAll(type, MemberTypes.Field, storableMembers); break;
    52           case StorableClassType.AllProperties:
     52          case StorableMemberSelection.AllProperties:
    5353            AddAll(type, MemberTypes.Property, storableMembers); break;
    54           case StorableClassType.AllFieldsAndAllProperties:
     54          case StorableMemberSelection.AllFieldsAndAllProperties:
    5555            AddAll(type, MemberTypes.Field | MemberTypes.Property, storableMembers); break;
    5656          default:
    57             throw new PersistenceException("unsupported [StorableClassType]: " + storableClassAttribute.Type);
     57            throw new PersistenceException("unsupported [StorableType]: " + storableTypeAttribute.MemberSelection);
    5858        }
    5959      }
     
    174174    #region [StorableClass] helpers
    175175
    176     private static StorableClassAttribute GetStorableClassAttribute(Type type) {
    177       lock (storableClassCache) {
    178         if (storableClassCache.ContainsKey(type))
    179           return storableClassCache[type];
    180         StorableClassAttribute attribute = type
    181           .GetCustomAttributes(typeof(StorableClassAttribute), false)
    182           .SingleOrDefault() as StorableClassAttribute;
    183         storableClassCache.Add(type, attribute);
     176    private static StorableTypeAttribute GetStorableTypeAttribute(Type type) {
     177      lock (storableTypeCache) {
     178        if (storableTypeCache.ContainsKey(type))
     179          return storableTypeCache[type];
     180        StorableTypeAttribute attribute = type
     181          .GetCustomAttributes(typeof(StorableTypeAttribute), false)
     182          .SingleOrDefault() as StorableTypeAttribute;
     183        storableTypeCache.Add(type, attribute);
    184184        return attribute;
    185185      }
     
    187187
    188188    public static bool HasStorableClassAttribute(Type type) {
    189       return GetStorableClassAttribute(type) != null;
    190     }
    191 
    192     private static Dictionary<Type, StorableClassAttribute> storableClassCache =
    193       new Dictionary<Type, StorableClassAttribute>();
     189      return GetStorableTypeAttribute(type) != null;
     190    }
     191
     192    private static Dictionary<Type, StorableTypeAttribute> storableTypeCache =
     193      new Dictionary<Type, StorableTypeAttribute>();
    194194
    195195    #endregion
  • branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs

    r14927 r14928  
    3434  /// <summary>
    3535  /// Intended for serialization of all custom classes. Classes should have the
    36   /// <c>[StorableClass]</c> attribute set. The default mode is to serialize
     36  /// <c>[StorableType]</c> attribute set. The default mode is to serialize
    3737  /// members with the <c>[Storable]</c> attribute set. Alternatively the
    3838  /// storable mode can be set to <c>AllFields</c>, <c>AllProperties</c>
  • branches/PersistenceReintegration/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/StructSerializer.cs

    r14927 r14928  
    3737
    3838    public int Priority {
    39       get { return 50; }
     39      get { return 210; } // higher than storabletype
    4040    }
    4141
Note: See TracChangeset for help on using the changeset viewer.