Changeset 6224 for branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers
- Timestamp:
- 05/17/11 15:10:19 (14 years ago)
- Location:
- branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableClassAnalyzer.cs
r6222 r6224 119 119 return; 120 120 var attribute = (StorableAttribute)fieldInfo.GetCustomAttributes(typeof(StorableAttribute), false).SingleOrDefault(); 121 if (attribute != null && classAttribute.Type != StorableClassType.AllProperties || 122 classAttribute.Type == StorableClassType.AllFields || 123 classAttribute.Type == StorableClassType.AllFieldsAndAllProperties) 121 if (attribute != null) 124 122 typeDescriptor.Fields.Add(new FieldDescriptor(typeDescriptor, fieldInfo, attribute)); 125 123 } … … 131 129 } 132 130 var attribute = (StorableAttribute)propertyInfo.GetCustomAttributes(typeof(StorableAttribute), false).SingleOrDefault(); 133 if (attribute != null && classAttribute.Type != StorableClassType.AllFields || 134 classAttribute.Type == StorableClassType.AllProperties || 135 classAttribute.Type == StorableClassType.AllFieldsAndAllProperties) { 136 if (!(attribute != null && attribute.AllowOneWay || 137 propertyInfo.CanRead && propertyInfo.CanWrite)) 131 if (attribute != null) { 132 if (!(attribute.AllowOneWay || propertyInfo.CanRead && propertyInfo.CanWrite)) 138 133 throw new PersistenceException("Properties have to be read/write or marked as one way storable"); 139 134 typeDescriptor.Properties.Add(new PropertyDescriptor(typeDescriptor, propertyInfo, attribute)); -
branches/PersistenceSpeedUp/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableClassAttribute.cs
r5445 r6224 30 30 public sealed class StorableClassAttribute : Attribute { 31 31 32 33 /// <summary>34 /// Specify how members are selected for serialization.35 /// </summary>36 public StorableClassType Type { get; private set; }37 38 /// <summary>39 /// Mark a class to be serialize by the <c>StorableSerizlier</c>40 /// </summary>41 /// <param name="type">The storable class type.</param>42 public StorableClassAttribute(StorableClassType type) {43 Type = type;44 }45 46 32 /// <summary> 47 33 /// Initializes a new instance of the <see cref="StorableClassAttribute"/> class. … … 51 37 public StorableClassAttribute() { } 52 38 53 /// <summary>54 /// Checks if the <see cref="StorableClassAttribute"/> is present on a type.55 /// </summary>56 /// <param name="type">The type which should be checked for the <see cref="StorableClassAttribute"/></param>57 /// <returns></returns>58 public static bool IsStorableClass(Type type) {59 object[] attribs = type.GetCustomAttributes(typeof(StorableClassAttribute), false);60 return attribs.Length > 0;61 }62 63 39 } 64 40 }
Note: See TracChangeset
for help on using the changeset viewer.