- Timestamp:
- 03/09/10 18:57:40 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableHookAttribute.cs
r2980 r2983 31 31 Type type = obj.GetType(); 32 32 foreach (MemberInfo memberInfo in type.GetMembers(instanceMembers)) { 33 foreach (object attribute in memberInfo.GetCustomAttributes(false)) { 34 StorableHookAttribute hook = attribute as StorableHookAttribute; 33 foreach (StorableHookAttribute hook in memberInfo.GetCustomAttributes(typeof(StorableHookAttribute), false)) { 35 34 if (hook != null && hook.HookType == hookType) { 36 35 MethodInfo methodInfo = memberInfo as MethodInfo; 37 36 if (memberInfo.MemberType != MemberTypes.Method || memberInfo == null) 38 throw new ArgumentException("Storable hooks must be methods"); 39 methodInfo.Invoke(obj, emptyArgs); 37 throw new ArgumentException("Storable hooks must be methods"); 38 methodInfo.Invoke(obj, emptyArgs); 40 39 } 41 40 } -
trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs
r2980 r2983 40 40 41 41 public object CreateInstance(Type type, IEnumerable<Tag> metaInfo) { 42 return Activator.CreateInstance(type, true); 42 object instance = StorableConstructorAttribute.CallStorableConstructor(type); 43 if (instance == null) 44 instance = Activator.CreateInstance(type, true); 45 return instance; 43 46 } 44 47
Note: See TracChangeset
for help on using the changeset viewer.