Changeset 6228 for branches/PersistenceSpeedUp/HeuristicLab.Persistence
- Timestamp:
- 05/17/11 17:16:33 (14 years ago)
- Location:
- branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableClassAnalyzer.cs
r6224 r6228 139 139 if (methodInfo.ReturnType != typeof(void) || methodInfo.GetParameters().Length > 0) 140 140 return; 141 var attribute = (StorableHookAttribute)methodInfo.GetCustomAttributes(typeof(StorableHookAttribute), false).SingleOrDefault(); 142 if (attribute != null) 143 typeDescriptor.Hooks.Add(new HookDescriptor(typeDescriptor, methodInfo, attribute.HookType)); 141 switch (methodInfo.Name) { 142 case "AfterDeserialization": 143 typeDescriptor.Hooks.Add(new HookDescriptor(typeDescriptor, methodInfo, HookType.AfterDeserialization)); 144 break; 145 case "BeforeSerialization": 146 typeDescriptor.Hooks.Add(new HookDescriptor(typeDescriptor, methodInfo, HookType.BeforeSerialization)); 147 break; 148 default: break; 149 } 144 150 } 145 151 } -
branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Tests/UseCases.cs
r6224 r6228 798 798 public bool WasSerialized { get; private set; } 799 799 [StorableHook(HookType.BeforeSerialization)] 800 void PreSerializationHook() {800 void BeforeSerialization() { 801 801 WasSerialized = true; 802 802 } 803 803 [StorableHook(HookType.AfterDeserialization)] 804 void PostDeserializationHook() {804 void AfterDeserialization() { 805 805 sum = a + b; 806 806 } … … 896 896 public object link; 897 897 [StorableHook(HookType.AfterDeserialization)] 898 private void relink() {898 private void AfterDeserialization() { 899 899 link = a; 900 900 } … … 906 906 public object b; 907 907 [StorableHook(HookType.AfterDeserialization)] 908 private void relink() {908 private void AfterDeserialization() { 909 909 Assert.AreSame(a, link); 910 910 link = b;
Note: See TracChangeset
for help on using the changeset viewer.