コード例 #1
0
        private object[] GetActionParameters()
        {
            ActionDescription action = this.InvokeInfo.Action;

            if (action.Parameters == null || action.Parameters.Length == 0)
            {
                return(null);
            }



            IActionParametersProvider provider
                = ActionParametersProviderFactory.Instance.CreateProvider(this.HttpContext);

            object[] parameters = null;

            IActionParametersProvider2 p2 = provider as IActionParametersProvider2;

            if (p2 != null)                             // 优先使用内部接口版本
            {
                parameters = p2.GetParameters(this.HttpContext, action);
            }
            else
            {
                parameters = provider.GetParameters(this.HttpContext, action.MethodInfo);
            }


            EventHandler <GetActionParametersEventArgs> eventHandler = this.OnGetActionParameters;

            if (eventHandler != null)
            {
                GetActionParametersEventArgs e = new GetActionParametersEventArgs {
                    HttpContext  = this.HttpContext,
                    ActionMethod = this.InvokeInfo.Action.MethodInfo,
                    Parameters   = parameters
                };

                eventHandler(this, e);

                return(e.Parameters);
            }

            return(parameters);
        }
コード例 #2
0
		private object[] GetActionParameters()
		{
			ActionDescription action = this.InvokeInfo.Action;

			if( action.Parameters == null || action.Parameters.Length == 0 )
				return null;



			IActionParametersProvider provider 
						= ActionParametersProviderFactory.Instance.CreateProvider(this.HttpContext);

			object[] parameters = null;

			IActionParametersProvider2 p2 = provider as IActionParametersProvider2;
			if( p2 != null )		// 优先使用内部接口版本
				parameters = p2.GetParameters(this.HttpContext, action);
			else
				parameters = provider.GetParameters(this.HttpContext, action.MethodInfo);


			EventHandler<GetActionParametersEventArgs> eventHandler = this.OnGetActionParameters;
			if( eventHandler != null ) {
				GetActionParametersEventArgs e = new GetActionParametersEventArgs {
					HttpContext = this.HttpContext,
					ActionMethod = this.InvokeInfo.Action.MethodInfo,
					Parameters = parameters
				};

				eventHandler(this, e);

				return e.Parameters;
			}

			return parameters;
		}