WCF Data Services-Alibaba Cloud Developer Community

The recently used WCF Data Service and WCF RIA Service examples are published on the website http://dskit.codeplex.com. This series of articles describe the main aspects involved in WCF Data Service and WCF RIA Service. We hope that through these contents, these frameworks can be used smoothly to improve development efficiency.


Several basic concepts in WCF Data Services

Tenets of REST

Method information is kept in the HTTP header, not in the body of the request.

  • Resource based

Resources are expressed as “services” that clients consume.

  • Addressability

The scoping information is kept in the URL. Operations such as $filter $top $skip

  • Relationships

How the data relates to each other is expressed in ADO.NET Data Services by resource links according to the CSDL [ specified in the Entity Data Model (EDM)]. A relationship link element such <link href=”Customers(‘ALFKI’)/Orders

  • Statelessness

No stateful messages are exchanged between resources

MIME type

you can use JSON or ATOM to return the MIME type in the request as follows:

HTTP Operation Success Return Codes

according to the definition of REST, the server return values defined for different operations are as follows:

Operation Success Code

GET 200 OK

POST 201 Created

PUT 204 No- Content

DELETE 204 No- Content

MERGE 204 No- Content

simple example

create a new WEB project in VS2010. Follow these steps to create an example project:


build Microsoft SQL example database NorthWind

1. Add Ado.net Entity: Select the initial SQL example NorthWind database

2. Add WCF Data Services:WcfDataService.svc

3. Configure access rules in WcfDataService.svc.cs:

config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);

config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);

config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;

the preceding section is used to configure various parameters such as service accessibility, permissions, and behaviors. For more information, see MSDN. If it is not published on the Internet, the default configuration can also be used.


4. Service access test: you can access the service after you Build the solution.

The following table lists several accessed instances.

[The project can be downloaded from http://dskit.codeplex.com]]


as you can see, there are very few codes written for publishing a data and processing it, but the functions provided are very powerful. We will continue to explain the query and so on in the future.

Please read this disclaimer carefully before you start to use the service. By using the service, you acknowledge that you have agreed to and accepted the content of this disclaimer in full. You may choose not to use the service if you do not agree to this disclaimer. This document is automatically generated based on public content on the Internet captured by Machine Learning Platform for AI. The copyright of the information in this document, such as web pages, images, and data, belongs to their respective author and publisher. Such automatically generated content does not reflect the views or opinions of Alibaba Cloud. It is your responsibility to determine the legality, accuracy, authenticity, practicality, and completeness of the content. We recommend that you consult a professional if you have any doubt in this regard. Alibaba Cloud accepts no responsibility for any consequences on account of your use of the content without verification. If you have feedback or you find that this document uses some content in which you have rights and interests, please contact us through this link: https://www.alibabacloud.com/campaign/contact-us-feedback. We will handle the matter according to relevant regulations.
Selected, One-Stop Store for Enterprise Applications
Support various scenarios to meet companies' needs at different stages of development

Start Building Today with a Free Trial to 50+ Products

Learn and experience the power of Alibaba Cloud.

Sign Up Now