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


C# IInvocationInfo.Proceed方法代码示例

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


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

示例1: Invoke

 public object Invoke(IInvocationInfo invocationInfo)
 {
     if (session.InTransaction)
     {
         return invocationInfo.Proceed();
     }
     using (var transaction = session.Connection.BeginTransaction())
     {
         session.InTransaction = true;
         try
         {
             var result = invocationInfo.Proceed();
             transaction.Commit();
             return result;
         }
         catch (Exception)
         {
             transaction.Rollback();
             throw;
         }
         finally
         {
             session.InTransaction = false;
         }
     }
 }
开发者ID:sunloving,项目名称:rooms-and-furniture,代码行数:26,代码来源:TransactionInterceptor.cs

示例2: Invoke

        public object Invoke(IInvocationInfo invocation)
        {

            var method = invocation.Proxy.Target.GetType().GetMethod(invocation.Method.Name);

            var joinPoint = new JoinPoint
            {
                Arguments = invocation.Arguments,

                MethodInfo = method,

                ReturnValue = null,

                TargetObject = invocation.Proxy.Target,

                TargetType = invocation.Proxy.Target.GetType(),

                ExecuteMethodFromProxy = (() =>
                {
                    var value = invocation.Proceed();

                    return value;
                }),
                
            };

            var typesToApply = _types.Where(x => _pointCut.CanApply(joinPoint, x)).ToArray();

            if (typesToApply.Length > 0)
            {
                var aspectsToApply = typesToApply.Select(x => _container.GetInstance(x) as IAspect).ToArray();

                aspectsToApply = aspectsToApply.OrderBy(x => x.GetOrder(joinPoint)).ToArray();

                var root = aspectsToApply[0];

                var aspect = root;

                for (var i = 1; i < aspectsToApply.Length; i++)
                {
                    aspect.NextAspect = aspectsToApply[i];

                    aspect = aspect.NextAspect;
                }

                root.Apply(joinPoint);

                return joinPoint.ReturnValue;
            }
            else
            {
                return invocation.Proceed();
            }

        }
开发者ID:raulnq,项目名称:Jal.Aop,代码行数:55,代码来源:AopProxy.cs

示例3: Invoke

        public object Invoke(IInvocationInfo invocationInfo)
        {
            //If there is a running transaction, just run the method
            if (NhUnitOfWork.Current != null)
            {
                return invocationInfo.Proceed();
            }

            object returnValue;
            try
            {
                NhUnitOfWork.Current = new NhUnitOfWork(sessionFactory);
                NhUnitOfWork.Current.BeginTransaction();
                try
                {
                    returnValue = invocationInfo.Proceed();
                    NhUnitOfWork.Current.Commit();

                }
                catch (Exception)
                {
                    try
                    {
                        NhUnitOfWork.Current.Rollback();
                    }
                    catch (Exception)
                    {

                    }

                    throw;
                }
            }
            finally
            {
                NhUnitOfWork.Current = null;
            }
            return returnValue;
        }
开发者ID:renatohh,项目名称:PhoneBook,代码行数:39,代码来源:UnitOfWorkInterceptor.cs

示例4: Invoke

 public object Invoke(IInvocationInfo invocationInfo)
 {
     try
     {
         // Perform logic before invoking the target method
         var returnValue = invocationInfo.Proceed();
         // Perform logic after invoking the target method
         return returnValue;
     }
     catch (Exception ex)
     {
         LogExceptionInformation(invocationInfo, ex);
         throw;
     }
 }
开发者ID:joefeser,项目名称:LightInjectInterceptorSample,代码行数:15,代码来源:ExceptionInterceptor.cs

示例5: Invoke

 /// <summary>
 /// Invoked when a method call is intercepted.
 /// </summary>
 /// <param name="invocationInfo">The <see cref="IInvocationInfo"/> instance that 
 /// contains information about the current method call.</param>
 /// <returns>The return value from the method.</returns>
 public object Invoke(IInvocationInfo invocationInfo)
 {
     serviceContainer.EndCurrentScope();
     return invocationInfo.Proceed();            
 }
开发者ID:vitamink,项目名称:LightInject,代码行数:11,代码来源:LightInject.SignalR.cs

示例6: Invoke

 public object Invoke(IInvocationInfo invocationInfo)
 {
     var args = string.Join(", ", invocationInfo.Arguments.Select(x => (x ?? string.Empty).ToString()));
     Debug.WriteLine("LightInject: {0}({1})", invocationInfo.Method, args);
     return invocationInfo.Proceed();
 }
开发者ID:CodeDux,项目名称:IocPerformance,代码行数:6,代码来源:LightInjectInterceptionLogger.cs

示例7: Invoke

 public object Invoke(IInvocationInfo invocationInfo)
 {
     return invocationInfo.Proceed();
 }
开发者ID:naeemkhedarun,项目名称:Benchmarks,代码行数:4,代码来源:DynamicProxyBenchmark.cs

示例8: Invoke

 public object Invoke(IInvocationInfo invocationInfo)
 {
     Bar.ToString();
     return invocationInfo.Proceed();
 }
开发者ID:vitamink,项目名称:LightInject,代码行数:5,代码来源:SampleInterceptor.cs


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