public void Run(IInvocation invocation, bool isFirstCall)
 {
     if (AttributeRecognize(invocation.Method) && isFirstCall)
     {
         CatchExceptionHelper.TryCatchAction(
             () => LockMethod(invocation.Proceed, invocation.Method.Name, isFirstCall),
             _logger);
     }
 }
Beispiel #2
0
        public void Intercept(IInvocation invocation)
        {
            var attributes = _attributeEngine.AutoFindAttribute("");

            foreach (var attribute in attributes)
            {
                var nameTemp = GetAttributeName(GetScanTaskName(attribute.FullName));

                var type = Type.GetType(nameTemp);

                if (type != null)
                {
                    var existedMethod = Attribute.GetCustomAttribute(invocation.GetConcreteMethodInvocationTarget(), type, false);

                    if (existedMethod != null)
                    {
                        var localAttribute = attribute;
                        CatchExceptionHelper.TryCatchAction(() => _attributeEngine.Run(invocation, localAttribute), _logger);
                    }
                }
            }
        }