Beispiel #1
0
        private bool ValidateCache(MethodInfo method)
        {
            var declaringType = method.DeclaringType.GetTypeInfo();

            if (declaringType.IsDynamically() || method.IsPropertyBinding())
            {
                return(false);
            }

            if (IsNonAspect(method) || IsNonAspect(declaringType))
            {
                return(false);
            }

            if (!IsAccessibility(declaringType) || !IsAccessibility(method))
            {
                return(false);
            }

            if (IsIgnored(aspectConfigure.GetConfigureOption <bool>(), method))
            {
                return(false);
            }

            return(HasInterceptor(method) || HasInterceptor(declaringType) || HasInterceptor <IInterceptor>(aspectConfigure.GetConfigureOption <IInterceptor>(), method));
        }
Beispiel #2
0
        public IInterceptor[] Match(MethodInfo serviceMethod, TypeInfo serviceTypeInfo)
        {
            if (serviceMethod == null)
            {
                throw new ArgumentNullException(nameof(serviceMethod));
            }
            if (serviceTypeInfo == null)
            {
                throw new ArgumentNullException(nameof(serviceTypeInfo));
            }

            var aggregate = Aggregate <IInterceptor>(serviceMethod, serviceTypeInfo, aspectConfigure.GetConfigureOption <IInterceptor>());

            return(aggregate.FilterMultiple().OrderBy(interceptor => interceptor.Order).ToArray());
        }