In order to get through the data platform of client, network and mobile phone, we studied the rest interface architecture for eight days.
The first is WCF rest, which understands rest and WCF rest. Detailed theoretical knowledge WCF REST----Theory preparation work
followed by practical applications, using WCF Data Service, detailed theoretical knowledge WCF data Service----theory preparation
There are many examples of creating WCF Data service online including MSDN.
The first step is to build a Web application
The second step is to add a ado.net Entity Data model, as shown in the following figure:
Then establish the entity model data, connect the corresponding database, the following figure:
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/net/
Generated by Wizard.
The third step is to add the WCF Data Service, as shown in the following figure:
Add the appropriate code at the prompt location as follows:
TODO: Set rules to indicate which entity sets and service operations are visible, updatable, and so on.
//Example:
//CONFIG. Setentitysetaccessrule ("Myentityset", entitysetrights.allread);
Config. Setserviceoperationaccessrule ("Myserviceoperation", Serviceoperationrights.all);
Config. Setentitysetaccessrule ("*", entitysetrights.allread);
Config. Setserviceoperationaccessrule ("*", serviceoperationrights.all);
Config. Dataservicebehavior.maxprotocolversion = Dataserviceprotocolversion.v2;
Then right-click in the browser to see the style information in the atompub format.