Http://www.cnblogs.com/2018/category/262512.html
Previous articlesArticleThe usage of the WCF data service is analyzed. In the development of the RIA system, similar to the WCF data service, the WCF Ria Service provides more convenient functions.
Currently, WCF Ria services is mainly used in silverligh scenarios.
Development Environment:
Vs2010
Siliverlight 4 tools for vs2010(silverligh4_tools.exe): sl4 SDK, Ria service, etc.
Silverlight 4 Toolkit
Riaservicestoolkit
Project template business application
This template contains the basic application framework of membership.
Template project directory structure
Server:
Models:
Dto: objects used for transmission on the server and client
Shared: used for sharing between the server and the client.Code
Resources:
Contains localized resource files [shared by connecting to the client and server]
Services
Domain service class: a service generated based on the WCF Ria services framework
Client:
The name is clear
If the hidden project file is displayed, you can see the generated_code directory. This IDE is based on the object automatically generated by WCF Ria services, so that the client does not manually generate a Project LINK through proxy ].
Add a new domain service
1. Add ado.net entity (edmx) and build the project
2. Add domain service class,
Build Project
3. You can access it in the browser, as shown in figure
[The service is automatically generated by a framework. The corresponding rules are as follows:
If the service class is: Ria. Web. Services. northwindservice
Then the SVC service address is the RIA-Web-Services-NorthWindService.svc
]
Odata format
Http: // localhost: 52878/RIA-Web-Services-NorthWindService.svc/odata/
Http: // localhost: 52878/RIA-Web-Services-NorthWindService.svc/odata/$ metadata
The Architecture Information is returned.
Http: // localhost: 52878/RIA-Web-Services-NorthWindService.svc/odata/customerset
The returned data content
Publish a service in JSON format
1. Add a service bearer component
C: \ Program Files \ microsoft sdks \ Ria Services \ V1.0 \ toolkit \ libraries \ Server \ Microsoft. servicemodel. domainservices. Hosting. dll
This is a set of implemented functions in the RIA toolkit.
2. Configure Components
Web. config
<Domainservices>
<Endpoints>
<Add name = "JSON" type ="
Microsoft. servicemodel. domainservices. Hosting. jsonendpointfactory, Microsoft. servicemodel. domainservices. Hosting,
Version = 4.0.0.0, culture = neutral, publickeytoken = 31bf3856ad364e35 "/>
3. Use Services
Http: // localhost: 52878/RIA-Web-Services-NorthWindService.svc/JSON/getcustomers
Example reference: http://dskit.codeplex.com