Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/25/09 17:52:02 (15 years ago)
Author:
epitzer
Message:

Remove old storable persistence mechanism. (#506)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/New Persistence Exploration/Persistence/Persistence/Core/Serializer.cs

    r1419 r1420  
    9292      IDecomposer decomposer = configuration.GetDecomposer(value.GetType());
    9393      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));     
    9699    }
    97100
     
    121124    }
    122125
    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 in
    128         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     }
    145126  }
    146127
Note: See TracChangeset for help on using the changeset viewer.