- Timestamp:
- 03/25/09 17:52:02 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/New Persistence Exploration/Persistence/Persistence/Core/Serializer.cs
r1419 r1420 92 92 IDecomposer decomposer = configuration.GetDecomposer(value.GetType()); 93 93 if (decomposer != null) 94 return CompositeEnumerator(accessor.Name, decomposer.DeCompose(value), id, typeId); 95 return StorableEnumerator(accessor.Name, value, id, typeId); 94 return CompositeEnumerator(accessor.Name, decomposer.DeCompose(value), id, typeId); 95 throw new ApplicationException( 96 String.Format( 97 "No suitable method for serializing values of type \"{0}\" found.", 98 value.GetType().FullName)); 96 99 } 97 100 … … 121 124 } 122 125 123 private IEnumerator<ISerializationToken> StorableEnumerator(string name,124 object value, int? id, int typeId) {125 yield return new BeginToken(name, typeId, id);126 int nSubComponents = 0;127 foreach (KeyValuePair<string, DataMemberAccessor> mapping in128 StorableAttribute.GetAutostorableAccessors(value)) {129 nSubComponents += 1;130 IEnumerator<ISerializationToken> iterator = Serialize(mapping.Value);131 while (iterator.MoveNext()) {132 yield return iterator.Current;133 }134 }135 if (nSubComponents == 0 && ! EmptyStorableClassAttribute.IsEmpyStorable(value.GetType())) {136 throw new ApplicationException(137 String.Format(138 "Value of type \"{0}\" has no formatter or decomposer, " +139 "contains no storable subcomponents, " +140 "and is not marked as empty storable class.",141 value.GetType().FullName));142 }143 yield return new EndToken(name, typeId, id);144 }145 126 } 146 127
Note: See TracChangeset
for help on using the changeset viewer.