public static string GenerateJavaScriptWrapper(IServerExtension ext)
 {
     var methods = (from method in GetOperationContractMethods(ext.GetType(), ExcludedExtensionJsMethodNames)
      let friendlyName = method.Name.StartsWith("get_") ? method.Name.Substring(4) : method.Name
      select string.Format("\t{0}: function({1}) {{ {2}__processJsonResponse(__ext_jsonCall('{3}', '{4}', __getJsonArgs(arguments))); }}",
         friendlyName, WriteArgumentsList(method), method.ReturnType == typeof(void) ? "" : "return ", ext.ID, method.Name))
         .Concat("," + Environment.NewLine);
     return string.Concat("Extensions.", ext.ID , " = {", Environment.NewLine, methods, Environment.NewLine, "};", Environment.NewLine);
 }
Esempio n. 2
0
        public static string GenerateJavaScriptWrapper(IServerExtension ext)
        {
            var methods = (from method in GetOperationContractMethods(ext.GetType(), ExcludedExtensionJsMethodNames)
                           let friendlyName = method.Name.StartsWith("get_") ? method.Name.Substring(4) : method.Name
                                              select string.Format("\t{0}: function({1}) {{ {2}__processJsonResponse(__ext_jsonCall('{3}', '{4}', __getJsonArgs(arguments))); }}",
                                                                   friendlyName, WriteArgumentsList(method), method.ReturnType == typeof(void) ? "" : "return ", ext.ID, method.Name))
                          .Concat("," + Environment.NewLine);

            return(string.Concat("Extensions.", ext.ID, " = {", Environment.NewLine, methods, Environment.NewLine, "};", Environment.NewLine));
        }