/// <summary> /// Returns a ClientMethod instance to get the name of the class and method name on the client-side JavaScript. /// </summary> /// <param name="method">The MethodInfo.</param> /// <returns> /// Returns the ClientMethod info, if it is not a AjaxMethod it will return null. /// </returns> public static ClientMethod FromMethodInfo(MethodInfo method) { if(method.GetCustomAttributes(typeof(AjaxPro.AjaxMethodAttribute), true).Length == 0) return null; AjaxPro.AjaxNamespaceAttribute[] classns = (AjaxPro.AjaxNamespaceAttribute[])method.ReflectedType.GetCustomAttributes(typeof(AjaxPro.AjaxNamespaceAttribute), true); AjaxPro.AjaxNamespaceAttribute[] methodns = (AjaxPro.AjaxNamespaceAttribute[])method.GetCustomAttributes(typeof(AjaxPro.AjaxNamespaceAttribute), true); ClientMethod cm = new ClientMethod(); if (classns.Length > 0) cm.ClassName = classns[0].ClientNamespace; else { if (Utility.Settings.UseSimpleObjectNaming) cm.ClassName = method.ReflectedType.Name; else cm.ClassName = method.ReflectedType.FullName; } if(methodns.Length > 0) cm.MethodName += methodns[0].ClientNamespace; else cm.MethodName += method.Name; return cm; }
/// <summary> /// Returns a ClientMethod instance to get the name of the class and method name on the client-side JavaScript. /// </summary> /// <param name="d">The Delegate.</param> /// <returns> /// Returns the ClientMethod info, if it is not a AjaxMethod it will return null. /// </returns> public static ClientMethod FromDelegate(Delegate d) { if (d == null) { return(null); } return(ClientMethod.FromMethodInfo(d.Method)); }
public static string GetClientMethod(MethodInfo method) { ClientMethod cm = ClientMethod.FromMethodInfo(method); if (cm == null) { return(null); } return(cm.ClassName + "," + cm.MethodName); }
/// <summary> /// Returns a ClientMethod instance to get the name of the class and method name on the client-side JavaScript. /// </summary> /// <param name="method">The MethodInfo.</param> /// <returns> /// Returns the ClientMethod info, if it is not a AjaxMethod it will return null. /// </returns> public static ClientMethod FromMethodInfo(MethodInfo method) { if (method.GetCustomAttributes(typeof(AjaxPro.AjaxMethodAttribute), true).Length == 0) { return(null); } AjaxPro.AjaxNamespaceAttribute[] classns = (AjaxPro.AjaxNamespaceAttribute[])method.ReflectedType.GetCustomAttributes(typeof(AjaxPro.AjaxNamespaceAttribute), true); AjaxPro.AjaxNamespaceAttribute[] methodns = (AjaxPro.AjaxNamespaceAttribute[])method.GetCustomAttributes(typeof(AjaxPro.AjaxNamespaceAttribute), true); ClientMethod cm = new ClientMethod(); if (classns.Length > 0) { cm.ClassName = classns[0].ClientNamespace; } else { if (Utility.Settings.UseSimpleObjectNaming) { cm.ClassName = method.ReflectedType.Name; } else { cm.ClassName = method.ReflectedType.FullName; } } if (methodns.Length > 0) { cm.MethodName += methodns[0].ClientNamespace; } else { cm.MethodName += method.Name; } return(cm); }