Ext.Net.HandlerMethods.GetStaticMethod C# (CSharp) Method

GetStaticMethod() private method

private GetStaticMethod ( string name ) : DirectMethod
name string
return DirectMethod
        public DirectMethod GetStaticMethod(string name)
        {
            foreach (DirectMethod method in this.StaticMethods)
            {
                if (method.Name == name)
                {
                    return method;
                }
            }

            this.staticMethods = null;

            foreach (DirectMethod method in this.StaticMethods)
            {
                if (method.Name == name)
                {
                    return method;
                }
            }

            return null;
        }

Usage Example

        public void ProcessRequest(HttpContext context)
        {
            DirectResponse responseObject = new DirectResponse(true);

            try
            {
                HandlerMethods handler    = HandlerMethods.GetHandlerMethods(context, context.Request.FilePath);
                string         methodName = HandlerMethods.GetMethodName(context);

                if (handler == null)
                {
                    throw new Exception("The Method '{0}' has not been defined.".FormatWith(context.Request.FilePath));
                }

                if (methodName.IsEmpty())
                {
                    throw new Exception("No methodName has been set in the configuration.");
                }

                DirectMethod directMethod = handler.GetStaticMethod(methodName);

                if (directMethod == null)
                {
                    throw new Exception("The static DirectMethod '{0}' has not been defined.".FormatWith(methodName));
                }

                responseObject.Result = directMethod.Invoke();
            }
            catch (Exception e)
            {
                if (HandlerMethods.RethrowException(context))
                {
                    throw e;
                }

                responseObject.Success      = false;
                responseObject.ErrorMessage = IsDebugging ? e.ToString() : e.Message;
            }

            context.Response.Cache.SetNoServerCaching();
            context.Response.Cache.SetMaxAge(TimeSpan.Zero);
            context.Response.Write(responseObject.ToString());
            context.Response.End();
        }
All Usage Examples Of Ext.Net.HandlerMethods::GetStaticMethod