Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/09/10 18:14:05 (15 years ago)
Author:
epitzer
Message:

add a new attribute for hooks to be called before serialization and after deserialization (#900)

Location:
trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs

    r1960 r2980  
    2929
    3030    public IEnumerable<Tag> CreateMetaInfo(object o) {
     31      StorableHookAttribute.InvokeHook(HookType.BeforeSerialization, o);
    3132      return new Tag[] { };
    3233    }
     
    4849        memberDict.Add(iter.Current.Name, iter.Current);
    4950      }
    50       foreach (var accessor in StorableAttribute.GetStorableAccessors(instance)) {       
     51      foreach (var accessor in StorableAttribute.GetStorableAccessors(instance)) {
    5152        if (memberDict.ContainsKey(accessor.Name)) {
    52           accessor.Set(memberDict[accessor.Name].Value);         
     53          accessor.Set(memberDict[accessor.Name].Value);
    5354        } else if (accessor.DefaultValue != null) {
    54           accessor.Set(accessor.DefaultValue);         
     55          accessor.Set(accessor.DefaultValue);
    5556        }
    5657      }
     58      StorableHookAttribute.InvokeHook(HookType.AfterDeserialization, instance);
    5759    }
    5860  }
Note: See TracChangeset for help on using the changeset viewer.