//- ~Write -//
 internal static void Write(DojoRpcServiceBase dojoService)
 {
     DojoServiceDescription desc = new DojoServiceDescription();
     desc.ServiceURL = HttpContext.Current.Request.Url.AbsoluteUri;
     //+
     Type t = dojoService.GetType();
     ScanMethods(t, desc);
     //+
     DataContractJsonSerializer s = new DataContractJsonSerializer(typeof(DojoServiceDescription));
     s.WriteObject(HttpContext.Current.Response.OutputStream, desc);
 }
        //- ~Write -//
        internal static void Write(DojoRpcServiceBase dojoService)
        {
            DojoServiceDescription desc = new DojoServiceDescription();

            desc.ServiceURL = HttpContext.Current.Request.Url.AbsoluteUri;
            //+
            Type t = dojoService.GetType();

            ScanMethods(t, desc);
            //+
            DataContractJsonSerializer s = new DataContractJsonSerializer(typeof(DojoServiceDescription));

            s.WriteObject(HttpContext.Current.Response.OutputStream, desc);
        }
 //- $ScanMethods -//
 private static void ScanMethods(Type type, DojoServiceDescription desc)
 {
     foreach (MethodInfo method in type.GetMethods())
     {
         Object[] os = method.GetCustomAttributes(typeof(DojoOperationAttribute), false);
         if (os.Length > 0)
         {
             DojoServiceDescriptionMethod m = new DojoServiceDescriptionMethod(method.Name);
             SearchAttributes(os, m);
             desc.MethodList.Add(m);
         }
     }
     desc.ServiceType = "JSON-RPC";
 }
 //- $ScanMethods -//
 private static void ScanMethods(Type type, DojoServiceDescription desc)
 {
     foreach (MethodInfo method in type.GetMethods())
     {
         Object[] os = method.GetCustomAttributes(typeof(DojoOperationAttribute), false);
         if (os.Length > 0)
         {
             DojoServiceDescriptionMethod m = new DojoServiceDescriptionMethod(method.Name);
             SearchAttributes(os, m);
             desc.MethodList.Add(m);
         }
     }
     desc.ServiceType = "JSON-RPC";
 }
Esempio n. 5
0
 //- ~CreateDescription -//
 internal static DojoServiceDescription CreateDescription(Type type, String url)
 {
     DojoServiceDescription desc = new DojoServiceDescription();
     desc.ServiceURL = url.Substring(0, url.Length - 4);
     MethodCatalog mc = ReflectionCache.GetSpecificMethodCatalog(type.FullName);
     foreach (String m in mc.Keys)
     {
         DojoServiceDescriptionMethod dm = new DojoServiceDescriptionMethod(m);
         foreach (String p in mc[m].Parameters.Keys)
         {
             dm.ParameterList.Add(new DojoServiceDescriptionMethodParameter(p));
         }
         desc.MethodList.Add(dm);
     }
     //+
     return desc;
 }
Esempio n. 6
0
        //- ~CreateDescription -//
        internal static DojoServiceDescription CreateDescription(Type type, String url)
        {
            DojoServiceDescription desc = new DojoServiceDescription();

            desc.ServiceURL = url.Substring(0, url.Length - 4);
            MethodCatalog mc = ReflectionCache.GetSpecificMethodCatalog(type.FullName);

            foreach (String m in mc.Keys)
            {
                DojoServiceDescriptionMethod dm = new DojoServiceDescriptionMethod(m);
                foreach (String p in mc[m].Parameters.Keys)
                {
                    dm.ParameterList.Add(new DojoServiceDescriptionMethodParameter(p));
                }
                desc.MethodList.Add(dm);
            }
            //+
            return(desc);
        }
Esempio n. 7
0
 //- @AddServiceDescription -//
 public static void AddServiceDescription(String type, DojoServiceDescription serviceDescription)
 {
     ServiceDescription.Add(type, serviceDescription);
 }