ASP.net Joyrock asynchronous application example, JSON-RPC usage, joyrockjson-rpc

Source: Internet
Author: User

ASP.net Joyrock asynchronous application example, JSON-RPC usage, joyrockjson-rpc

To use Joyrock, you must first reference the Jayrock. dll and Jayrock. Json. dll files, and introduce the json. js files on the web page (json. js files downloaded from different places cannot be used ),

. Net Background File

Using System; using System. collections. generic; using System. linq; using System. web; using Jayrock. json; using Jayrock. jsonRpc; using Jayrock. jsonRpc. web; namespace Exam. jayrock {public class Handler1: jsonRpcHandler {// <summary> /// without parameters /// </summary> /// <returns> </returns> [JsonRpcMethod ("getstring1")] public string getstring1 () {return String. format ("Welcome to Jayrock by {0 }! ", DateTime. now);} // <summary> // with parameters /// </summary> /// <param Name = "str"> The string. </param> // <returns> </returns> [JsonRpcMethod ("getstring2")] public string getstring2 (string str) {return String. format ("Welcome to Jayrock by {0 }! ", Str);} [JsonRpcMethod (" addEntity ")] public int addEntity (JsonObject ent) {new Entity (" demo "). addEntity (ent); return 1;} [JsonRpcMethod ("updateEntity")] public int updateEntity (JsonObject ent) {new Entity ("demo "). updateEntity (ent); return 1;} [JsonRpcMethod ("delEntity")] public int delEntity (int id) {new Entity ("demo "). delEntity (id); return 1;} [JsonRpcMethod ("getEntityList")] public List <JsonObject> getEntityList (string where) {return new Entity ("demo "). getEntityList (where );}}}

Frontend call page

<Html xmlns = "http://www.w3.org/1999/xhtml"> 


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.