- Timestamp:
- 07/22/10 00:44:01 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableAttribute.cs
r3742 r4068 21 21 22 22 using System; 23 using System.Linq;24 using System.Collections.Generic;25 using System.Reflection;26 23 using System.Text; 27 24 … … 38 35 AttributeTargets.Field | AttributeTargets.Property, 39 36 AllowMultiple = false, 40 Inherited = false)] 37 Inherited = false)] 41 38 public class StorableAttribute : Attribute { 42 39 -
trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableClassAttribute.cs
r3742 r4068 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Reflection;25 using System.Linq;26 23 27 namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable { 24 namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable { 28 25 29 26 /// <summary> -
trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableClassType.cs
r3742 r4068 20 20 #endregion 21 21 22 using System;23 using System.Collections.Generic;24 using System.Reflection;25 using System.Linq;26 22 27 23 namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable { … … 62 58 /// </summary> 63 59 AllFieldsAndAllProperties 64 }; 60 }; 65 61 } 66 62 -
trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableConstructorAttribute.cs
r3742 r4068 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Linq;25 using System.Text;26 using System.Reflection;27 using HeuristicLab.Persistence.Core;28 23 29 24 namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable { … … 39 34 /// </summary> 40 35 [AttributeUsage(AttributeTargets.Constructor, Inherited = false, AllowMultiple = false)] 41 public sealed class StorableConstructorAttribute : Attribute { 36 public sealed class StorableConstructorAttribute : Attribute { } 42 37 } -
trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableHookAttribute.cs
r3742 r4068 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Linq;25 using System.Text;26 using System.Reflection;27 23 28 24 namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable { … … 39 35 /// </summary> 40 36 BeforeSerialization, 41 37 42 38 /// <summary> 43 39 /// States that this hook should be called after the storable 44 40 /// serializer hast complete re-assembled the object. 45 41 /// </summary> 46 AfterDeserialization }; 42 AfterDeserialization 43 }; 47 44 48 45 … … 52 49 /// </summary> 53 50 [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = true)] 54 public sealed class StorableHookAttribute : Attribute { 51 public sealed class StorableHookAttribute : Attribute { 55 52 56 53 private readonly HookType hookType; … … 70 67 public StorableHookAttribute(HookType hookType) { 71 68 this.hookType = hookType; 72 } 69 } 73 70 } 74 71 } -
trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableMemberInfo.cs
r3742 r4068 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Linq;25 using HeuristicLab.Persistence.Interfaces;26 using HeuristicLab.Persistence.Core;27 23 using System.Reflection; 28 using HeuristicLab.Persistence.Auxiliary;29 24 using System.Text; 30 25 … … 59 54 return ((PropertyInfo)MemberInfo).GetGetMethod(true).GetBaseDefinition().DeclaringType; 60 55 } 61 } 56 } 62 57 } -
trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableReflection.cs
r3917 r4068 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HeuristicLab.Persistence.Interfaces;25 using System.Reflection; 26 26 using HeuristicLab.Persistence.Core; 27 using System.Reflection;28 using HeuristicLab.Persistence.Auxiliary;29 using System.Text;30 using System.Reflection.Emit;31 27 32 28 namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable { -
trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs
r3913 r4068 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using System.Reflection; 26 using System.Reflection.Emit; 27 using System.Text; 28 using HeuristicLab.Persistence.Core; 25 29 using HeuristicLab.Persistence.Interfaces; 26 using HeuristicLab.Persistence.Core;27 using System.Reflection;28 using HeuristicLab.Persistence.Auxiliary;29 using System.Text;30 using System.Reflection.Emit;31 30 32 31 namespace HeuristicLab.Persistence.Default.CompositeSerializers.Storable { … … 87 86 sb.Append("class has no default constructor and no [StorableConstructor]"); 88 87 if (!StorableReflection.IsEmptyOrStorableType(type, true)) 89 sb.Append("class (or one of its bases) is not empty and not marked [Storable]; "); 88 sb.Append("class (or one of its bases) is not empty and not marked [Storable]; "); 90 89 return sb.ToString(); 91 90 } … … 123 122 try { 124 123 return GetConstructor(type)(); 125 } catch (TargetInvocationException x) { 124 } 125 catch (TargetInvocationException x) { 126 126 throw new PersistenceException( 127 127 "Could not instantiate storable object: Encountered exception during constructor call", … … 188 188 189 189 private Dictionary<HookDesignator, List<StorableReflection.Hook>> hookCache = 190 new Dictionary<HookDesignator, List<StorableReflection.Hook>>(); 190 new Dictionary<HookDesignator, List<StorableReflection.Hook>>(); 191 191 192 192 #endregion … … 203 203 accessorListCache[type] = storableMembers; 204 204 return storableMembers; 205 } 205 } 206 206 } 207 207 … … 224 224 return c; 225 225 } 226 } 226 } 227 227 228 228 private Constructor GetDefaultConstructor(Type type) { 229 229 ConstructorInfo ci = type.GetConstructor(ALL_CONSTRUCTORS, null, Type.EmptyTypes, null); 230 230 if (ci == null) 231 return null; 231 return null; 232 232 DynamicMethod dm = new DynamicMethod("", typeof(object), null, type); 233 233 ILGenerator ilgen = dm.GetILGenerator(); … … 242 242 if (ci.GetParameters().Length != 1 || 243 243 ci.GetParameters()[0].ParameterType != typeof(bool)) 244 throw new PersistenceException("StorableConstructor must have exactly one argument of type bool"); 244 throw new PersistenceException("StorableConstructor must have exactly one argument of type bool"); 245 245 DynamicMethod dm = new DynamicMethod("", typeof(object), null, type); 246 246 ILGenerator ilgen = dm.GetILGenerator(); … … 252 252 } 253 253 return null; 254 } 254 } 255 255 256 256 private void InvokeHook(HookType hookType, object obj) {
Note: See TracChangeset
for help on using the changeset viewer.