当前位置: 首页>>代码示例>>C#>>正文


C# IMethodInvocation.Proceed方法代码示例

本文整理汇总了C#中IMethodInvocation.Proceed方法的典型用法代码示例。如果您正苦于以下问题:C# IMethodInvocation.Proceed方法的具体用法?C# IMethodInvocation.Proceed怎么用?C# IMethodInvocation.Proceed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IMethodInvocation的用法示例。


在下文中一共展示了IMethodInvocation.Proceed方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Invoke

        public object Invoke(IMethodInvocation invocation)
        {
            if (invocation.Method.Name != "GetWebRequest")
                return invocation.Proceed();

            var request = (WebRequest) invocation.Proceed();
            if (request != null)
                _modifier.ModifyRequest(request);

            return request;
        }
开发者ID:sadowskik,项目名称:WebServiceInvoker,代码行数:11,代码来源:WebRequestModifyInterceptor.cs

示例2: Invoke

 public object Invoke(IMethodInvocation invocation)
 {
     Console.WriteLine("Before: {0}", invocation.Method.Name);
     var returnValue = (int)invocation.Proceed() * 2;
     Console.WriteLine("After: {0}", invocation.Method.Name);
     return returnValue;
 }
开发者ID:KenVanGilbergen,项目名称:ken.Spikes.Aspects,代码行数:7,代码来源:MyAspect.cs

示例3: Invoke

        /// <summary>
        /// AOP Alliance invoke call that handles all transaction plumbing. 
        /// </summary>
        /// <param name="invocation">
        /// The method that is to execute in the context of a transaction.
        /// </param>
        /// <returns>The return value from the method invocation.</returns>
        public object Invoke(IMethodInvocation invocation)
        {
            // Work out the target class: may be <code>null</code>.
            // The TransactionAttributeSource should be passed the target class
            // as well as the method, which may be from an interface.
            Type targetType = ( invocation.This != null ) ? invocation.This.GetType() : null;

            // If the transaction attribute is null, the method is non-transactional.
            TransactionInfo txnInfo = CreateTransactionIfNecessary( invocation.Method, targetType );
            object returnValue = null;

            try
            {
                // This is an around advice.
                // Invoke the next interceptor in the chain.
                // This will normally result in a target object being invoked.
                returnValue = invocation.Proceed();
            }
            catch ( Exception ex )
            {
                // target invocation exception
                CompleteTransactionAfterThrowing( txnInfo, ex );
                throw;
            }
            finally
            {
                CleanupTransactionInfo( txnInfo );
            }
            CommitTransactionAfterReturning( txnInfo );
            return returnValue;
        }
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:38,代码来源:TransactionInterceptor.cs

示例4: Invoke

 public object Invoke(IMethodInvocation invocation)
 {
     Console.WriteLine("开始:  " + invocation.TargetType.Name + "." + invocation.Method.Name);
     object result = invocation.Proceed();
     Console.WriteLine("结束:  " + invocation.TargetType.Name + "." + invocation.Method.Name);
     return result;
 }
开发者ID:sdgdsffdsfff,项目名称:huapuyu,代码行数:7,代码来源:AroundAdvice.cs

示例5: Invoke

 public object Invoke(IMethodInvocation invocation)
 {
     ILog log = LogFactory.Create(invocation.TargetType);
     object result = invocation.Proceed();
     log.Write(invocation.TargetType.Name + "." + invocation.Method.Name, LogLevel.Info);
     return result;
 }
开发者ID:SaintLoong,项目名称:UltraNuke_Library,代码行数:7,代码来源:LogAdvice.cs

示例6: Invoke

        /// <summary>
        ///  Handle 'around' advice for services
        /// </summary>
        public object Invoke(IMethodInvocation invocation)
        {
            object returnValue = null;

            using (Repository repository = new Repository(Repository.SessionFactory))
            {
                repository.BeginTransaction();

                DomainRegistry.Repository = repository;
                DomainRegistry.Library = null;

                try
                {
                    returnValue = invocation.Proceed();

                    repository.CommitTransaction();
                }
                catch (Exception e)
                {
                    returnValue = ServiceResult.Error(invocation.Method.ReturnType, e);
                }
            }

            return returnValue;
        }
开发者ID:FlukeFan,项目名称:Atlanta,代码行数:28,代码来源:AopAroundAdvice.cs

示例7: Invoke

        public object Invoke(IMethodInvocation invocation)
        {
            var trs = (EventPublishAttribute)invocation.Method.GetCustomAttributes(typeof(EventPublishAttribute), false)[0];

            object returnValue = null;

            try
            {

                if (trs.Pointcut == PubulishPointcut.Before || trs.Pointcut == PubulishPointcut.Both)
                {
                    if(_log.IsDebugEnabled)_log.Debug("���ص�һ���¼��������� ǰ��:" + invocation.TargetType.FullName + ", " + invocation.Method.Name);
                    EventAggregator.Publish(GetEventModel(trs, invocation));
                }

                returnValue = invocation.Proceed();

                if (trs.Pointcut == PubulishPointcut.After || trs.Pointcut == PubulishPointcut.Both)
                {
                    if (_log.IsDebugEnabled) _log.Debug("���ص�һ���¼��������� ����:" + invocation.TargetType.FullName + ", " + invocation.Method.Name);
                    EventAggregator.Publish(GetEventModel(trs, invocation));
                }

            }
            catch (Exception)
            {

                throw;
            }

            return returnValue;
        }
开发者ID:BGCX262,项目名称:zxd-svn-to-git,代码行数:32,代码来源:EventPublishAdvice.cs

示例8: Invoke

 public object Invoke(IMethodInvocation invocation)
 {
     Console.Out.WriteLine("Advice executing; calling the advised method...");
     object returnValue = invocation.Proceed();
     Console.Out.WriteLine("Advice executed; advised method returned " + returnValue);
     return returnValue;
 }
开发者ID:laball,项目名称:demo,代码行数:7,代码来源:Program.cs

示例9: Invoke

		public object Invoke(IMethodInvocation invocation)
		{
            ConsoleLoggingAttribute[] consoleLoggingInfo =
                (ConsoleLoggingAttribute[])invocation.Method.GetCustomAttributes(typeof(ConsoleLoggingAttribute), false);

            if (consoleLoggingInfo.Length > 0)
            {
                Color = consoleLoggingInfo[0].Color;
            }

            ConsoleColor currentColor = Console.ForegroundColor;

            Console.ForegroundColor = Color;

            Console.Out.WriteLine(String.Format(
                "Intercepted call : about to invoke method '{0}'", invocation.Method.Name));

            Console.ForegroundColor = currentColor;

            object returnValue = invocation.Proceed();

            Console.ForegroundColor = Color;

            Console.Out.WriteLine(String.Format(
                "Intercepted call : returned '{0}'", returnValue));

            Console.ForegroundColor = currentColor;

			return returnValue;
		}
开发者ID:Binodesk,项目名称:spring-net,代码行数:30,代码来源:ConsoleLoggingAdvice.cs

示例10: Invoke

    public object Invoke(IMethodInvocation invocation)
    {
        if (invocation.Method.ReturnType != typeof(string[]))
            throw new NotSupportedException(
                "StringArrayFilterAdvice must be applied on methods " +
                "that return an array of string.");

        string[] stringArray = (string[])invocation.Proceed();

        if (_pattern.Length > 0)
        {
            List<string> strings = new List<string>();
            foreach (string item in stringArray)
            {
                if (PatternMatchUtils.SimpleMatch(_pattern, item))
                {
                    strings.Add(item);
                }
            }

            return strings.ToArray();
        }

        return stringArray;
    }
开发者ID:Binodesk,项目名称:spring-net,代码行数:25,代码来源:StringArrayFilterAdvice.cs

示例11: Invoke

 public object Invoke(IMethodInvocation invocation)
 {
     LOG.Debug("Advice executing; calling the advised method [" + invocation.Method.Name + "]");
     object returnValue = invocation.Proceed();
     LOG.Debug("Advice executed; advised method [" + invocation.Method.Name + "] returned " + returnValue);
     return returnValue;
 }
开发者ID:spring-projects,项目名称:spring-net,代码行数:7,代码来源:ConsoleLoggingAroundAdvice.cs

示例12: Invoke

		public object Invoke(IMethodInvocation invocation)
		{
			Console.WriteLine("Before {0} on {1}", invocation.Method.Name,  invocation.Method.DeclaringType);
			object returnVal = invocation.Proceed();
			Console.WriteLine("After {0} on {1}", invocation.Method.Name,  invocation.Method.DeclaringType);
			return returnVal;
		}
开发者ID:ralescano,项目名称:castle,代码行数:7,代码来源:LoggerInterceptor.cs

示例13: Invoke

		public object Invoke(IMethodInvocation invocation)
		{
			Log("Intercepted call : about to invoke method '{0}'", invocation.Method.Name);
			object returnValue = invocation.Proceed();
			Log("Intercepted call : returned '{0}'", returnValue);
			return returnValue;
		}
开发者ID:fgq841103,项目名称:spring-net,代码行数:7,代码来源:CommonLoggingAroundAdvice.cs

示例14: Invoke

 public object Invoke(IMethodInvocation invocation)
 {
     String user = HttpContext.Current.User.Identity.Name;
     log.Debug(String.Format("{0} - {1} - called by: {2}", invocation.Method.Name, invocation.TargetType.Name,user));
     object returnValue = invocation.Proceed();
     log.Debug(String.Format("{0} - {1} - finished", invocation.Method.Name, invocation.TargetType.Name));
     return returnValue;
 }
开发者ID:al-main,项目名称:CloudyBank,代码行数:8,代码来源:LoggingAdvice.cs

示例15: Invoke

		public object Invoke(IMethodInvocation invocation)
		{
			Console.WriteLine("Calling {0}({1}) method...",
							  invocation.Method.Name,
							  string.Join(", ", invocation.Arguments.Select(a => a.ToString()).ToArray()));

			return invocation.Proceed();
		}
开发者ID:Suremaker,项目名称:Spring.FluentContext,代码行数:8,代码来源:DisplayingInterceptor.cs


注:本文中的IMethodInvocation.Proceed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。