コード例 #1
0
 protected override IEnumerable <ICallHandler> DoGetHandlersFor(MethodImplementationInfo member, IUnityContainer container)
 {
     if (member.InterfaceMethodInfo != null)
     {
         foreach (var handlerAttribute in ReflectionHelper.GetAllAttributes <PerMethodHandlerAttribute>(member.InterfaceMethodInfo, true))
         {
             yield return(handlerAttribute.CreateHandler(container, member));
         }
     }
     foreach (var handlerAttribute in ReflectionHelper.GetAllAttributes <PerMethodHandlerAttribute>(member.ImplementationMethodInfo, true))
     {
         yield return(handlerAttribute.CreateHandler(container, member));
     }
 }
コード例 #2
0
 /// <summary>
 /// Checks to see if <paramref name="member"/> matches the rule.
 /// </summary>
 /// <remarks>Returns true if any <see cref="HandlerAttribute"/>s are present on the method
 /// or the type containing that method.</remarks>
 /// <param name="member">Member to check.</param>
 /// <returns>true if member matches, false if not.</returns>
 public bool Matches(MethodBase member)
 {
     return(ReflectionHelper.GetAllAttributes <HandlerAttribute>(member, true).Length > 0);
 }