Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/18/11 15:50:23 (14 years ago)
Author:
epitzer
Message:

Implement one-way serialization that allows either only loading or only saving of storable members by setting a new property called AllowOneWay on the [Storable] attribute (#1385)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/CompositeSerializers/Storable/StorableSerializer.cs

    r5292 r5324  
    118118    public IEnumerable<Tag> Decompose(object obj) {
    119119      foreach (var accessor in GetStorableAccessors(obj.GetType())) {
    120         yield return new Tag(accessor.Name, accessor.Get(obj));
     120        if (accessor.Get != null)
     121          yield return new Tag(accessor.Name, accessor.Get(obj));
    121122      }
    122123    }
     
    151152      }
    152153      foreach (var accessor in GetStorableAccessors(instance.GetType())) {
    153         if (memberDict.ContainsKey(accessor.Name)) {
    154           accessor.Set(instance, memberDict[accessor.Name].Value);
    155         } else if (accessor.DefaultValue != null) {
    156           accessor.Set(instance, accessor.DefaultValue);
     154        if (accessor.Set != null) {
     155          if (memberDict.ContainsKey(accessor.Name)) {
     156            accessor.Set(instance, memberDict[accessor.Name].Value);
     157          } else if (accessor.DefaultValue != null) {
     158            accessor.Set(instance, accessor.DefaultValue);
     159          }
    157160        }
    158161      }
Note: See TracChangeset for help on using the changeset viewer.