Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/23/10 14:13:58 (15 years ago)
Author:
epitzer
Message:

correctly allow interleaving of storable and empty classes (#548)

File:
1 edited

Legend:

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

    r3031 r3205  
    4242    }
    4343
    44     public static bool IsEmptyOrStorableType(Type type, bool recusrive) {
    45       if (IsEmptyType(type, recusrive)) return true;
    46       if (!HasStorableClassAttribute(type)) return false;
    47       return !recusrive || type.BaseType == null || IsEmptyOrStorableType(type.BaseType, true);
     44    public static bool IsEmptyOrStorableType(Type type, bool recursive) {     
     45      if (!HasStorableClassAttribute(type) && !IsEmptyType(type, false)) return false;
     46      return !recursive || type.BaseType == null || IsEmptyOrStorableType(type.BaseType, true);
    4847    }
    4948
     
    7776      foreach (MemberInfo memberInfo in type.GetMembers(DECLARED_INSTANCE_MEMBERS)) {
    7877        if ((memberInfo.MemberType & memberTypes) == memberInfo.MemberType &&
    79             !memberInfo.Name.StartsWith("<") && 
     78            !memberInfo.Name.StartsWith("<") &&
    8079            !memberInfo.Name.EndsWith("k__BackingField"))
    8180          storableMembers.Add(new StorableMemberInfo(memberInfo));
     
    133132        .GetCustomAttributes(typeof(StorableClassAttribute), false)
    134133        .SingleOrDefault();
    135     }   
     134    }
    136135
    137136    private static bool HasStorableClassAttribute(Type type) {
     
    152151    private static bool IsModifiableMember(MemberInfo memberInfo) {
    153152      return memberInfo.MemberType == MemberTypes.Field && IsModifiableField((FieldInfo)memberInfo) ||
    154                 memberInfo.MemberType == MemberTypes.Property && IsModifiableProperty((PropertyInfo)memberInfo);
     153             memberInfo.MemberType == MemberTypes.Property && IsModifiableProperty((PropertyInfo)memberInfo);
    155154    }
    156155
Note: See TracChangeset for help on using the changeset viewer.