Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/12/10 10:43:08 (15 years ago)
Author:
epitzer
Message:

invoke storable hooks in more predictable orders, call hooks defined on base classes first. (#548)

File:
1 edited

Legend:

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

    r2994 r3010  
    4646    }
    4747
    48     private static readonly BindingFlags instanceMembers =
    49       BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public;
     48    private static readonly BindingFlags declaredInstanceMembers =
     49      BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.DeclaredOnly;
    5050
    5151    private static readonly object[] emptyArgs = new object[] { };
     
    7979    }
    8080
    81     private static IEnumerable<MethodInfo> CollectHooks(HookType hookType, Type type) {     
    82       foreach (MemberInfo memberInfo in type.GetMembers(instanceMembers)) {
     81    private static IEnumerable<MethodInfo> CollectHooks(HookType hookType, Type type) { 
     82      if (type.BaseType != null)
     83        foreach (var mi in CollectHooks(hookType, type.BaseType))
     84          yield return mi;
     85      foreach (MemberInfo memberInfo in type.GetMembers(declaredInstanceMembers)) {
    8386        foreach (StorableHookAttribute hook in memberInfo.GetCustomAttributes(typeof(StorableHookAttribute), false)) {
    8487          if (hook != null && hook.HookType == hookType) {
Note: See TracChangeset for help on using the changeset viewer.