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


C# IInvocation.GetConcreteMethodInvocationTarget方法代码示例

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


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

示例1: InvokeOnCurrentInstance

		static object InvokeOnCurrentInstance(IInvocation invocation)
		{
			Type pluginType = invocation.TargetType;

			EventDetails eventDetails = EnsureInitializedAndEnabled(pluginType);
			MethodInfo method = invocation.GetConcreteMethodInvocationTarget();

			return method.Invoke(eventDetails.Event, invocation.Arguments);
		}
开发者ID:agross,项目名称:graffiti-usergroups,代码行数:9,代码来源:PluginConfigurationInterceptor.cs

示例2: MakeInterception

        protected override void MakeInterception(IInvocation invocation)
        {
            var parameters = invocation.GetConcreteMethodInvocationTarget().GetParameters().Select(a => a.Name);

            Logger.DebugFormat("{0} - TargetType: {1}", InterceptorName, invocation.TargetType);
            Logger.DebugFormat("{0} - Method.Name: {1}", InterceptorName, invocation.Method.Name);
            Logger.DebugFormat("{0} - Parameters: {1}", InterceptorName, string.Join(", ", parameters));

            invocation.Proceed();
        }
开发者ID:JoakimBrannstrom,项目名称:IocLab,代码行数:10,代码来源:LogInterceptor.cs

示例3: Intercept

        public void Intercept(IInvocation invocation)
        {
            var joinPoint = new JoinPoint
            {
                Arguments = invocation.Arguments,

                MethodInfo = invocation.GetConcreteMethodInvocationTarget(),

                ReturnValue = invocation.ReturnValue,

                TargetObject = invocation.InvocationTarget,

                TargetType = invocation.TargetType,

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

                    return invocation.ReturnValue;
                }),

                SetReturnValueToProxy = ((o) => invocation.ReturnValue = o)
            };

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

            if (typesToApply.Length > 0)
            {
                var aspectsToApply = typesToApply.Select(x => _container.Resolve(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);
            }
            else
            {
                invocation.Proceed();
            }

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

示例4: GetCacheKey

        private static string GetCacheKey(IInvocation invocation)
        {
            var fullName = invocation.TargetType.FullName;
            var method = invocation.Method.Name;
            var argumentNames = invocation.GetConcreteMethodInvocationTarget().GetParameters().Select(a => a.Name);
            var argumentValues = string.Join("_", invocation.Arguments);

            return string.Format(
                "{0}_{1}_{2}_{3}",
                fullName,
                method,
                string.Join("_", argumentNames),
                argumentValues);
        }
开发者ID:JoakimBrannstrom,项目名称:IocLab,代码行数:14,代码来源:CacheInterceptor.cs

示例5: Intercept

        /// <summary>
        /// Intercepts the specified invocation.
        /// </summary>
        /// <param name="invocation">The invocation.</param>
        public void Intercept(IInvocation invocation)
        {
            MethodInfo method = invocation.GetConcreteMethodInvocationTarget();
            RemoteMethodInfo remoteMethod = null;
            if (method.DeclaringType == typeof(IRemoteCaller)) {
                invocation.ReturnValue = method.Invoke(invocation.InvocationTarget, invocation.Arguments);
                return;
            }
 
            remoteMethod = InterfaceConfigLoader.GetServiceInfo(method);
            if (!remoteMethod.Offline)
            {
                if (invocation.Method.IsDefined(typeof(ClientCacheAttribute), true))
                {
                    // 获取缓存结果
                    if (ClientCacheManager.HasCache(method, invocation.Arguments))
                        invocation.ReturnValue = ClientCacheManager.GetCachedData(method, invocation.Arguments);
                    else
                    {
                        // 第一次调用
                        object result = InvokeCommand(method, invocation.Arguments);
                        ClientCacheManager.RegisterCache(method, result, remoteMethod.DataUpdateEvent, invocation.Arguments);
                        invocation.ReturnValue = result;
                    }
                }
                else
                    invocation.ReturnValue = InvokeCommand(method, invocation.Arguments);
            }
            else
            {
                if (invocation.Method.IsDefined(typeof(ClientCacheAttribute), true))
                {
                    if (ClientCacheManager.HasCache(method, invocation.Arguments))
                        invocation.ReturnValue = ClientCacheManager.GetCachedData(method, invocation.Arguments);
                    else
                    {
                        object result = InvokeCommand(method, invocation.Arguments);
                        ClientCacheManager.RegisterCache(method, result, remoteMethod.DataUpdateEvent, invocation.Arguments);
                        invocation.ReturnValue = result;
                    }
                }
                else
                    OfflineProcess(invocation.Method, invocation.Arguments); // 调用离线处理方法
            }
        }
开发者ID:wuyingyou,项目名称:uniframework,代码行数:49,代码来源:ServiceProxyInterceptor.cs

示例6: MakeInterception

        protected override void MakeInterception(IInvocation invocation)
        {
            var args = invocation.GetConcreteMethodInvocationTarget().GetParameters();

            var failedArgs = args
                                .Where(a =>
                                       a.IsDefined(typeof (NotNullAttribute), true) &&
                                       (invocation.Arguments[a.Position] == null));

            if (failedArgs.Any())
            {
                Logger.DebugFormat(
                    "{0} - Argument(s) that failed NotNull-inspection: {1}",
                    InterceptorName,
                    string.Join(", ", failedArgs.Select(a => a.Name)));

                throw new ArgumentNullException(failedArgs.First().Name);
            }

            Logger.DebugFormat("{0} - Arguments passed NotNull-inspection.", InterceptorName);

            invocation.Proceed();
        }
开发者ID:JoakimBrannstrom,项目名称:IocLab,代码行数:23,代码来源:NotNullInterceptor.cs

示例7: Handle

 public bool Handle(IInvocation invocation)
 {
     return VerifyReturnTypeIsServiceReply(invocation.GetConcreteMethodInvocationTarget().ReturnType);
 }
开发者ID:judemifsud,项目名称:BookAssignments,代码行数:4,代码来源:ServiceReplyInvocationHandler.cs

示例8: CreateErrorResponse

 public object CreateErrorResponse(IInvocation invocation, BusinessException exception)
 {
     return CreateFailedServiceReply(invocation.GetConcreteMethodInvocationTarget().ReturnType,
                                     new ServiceFault(exception));
 }
开发者ID:judemifsud,项目名称:BookAssignments,代码行数:5,代码来源:ServiceReplyInvocationHandler.cs


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