Recently a small project, which used the WCF data service, previously called the Ado.net Data service. About WCF Data Service, the blog is not a lot of introductions, but it is really a good framework. It is easy to access the database through HTTP, if you are doing rich client development, use it can greatly reduce your workload. Out of love for this framework, write down some of your experience and hope that more people will be able to use it.
OData Introduction
Speaking of WCF Data Service, I have to say is OData. For a standard WEB service, it often provides some functionality, such as ordering, returning these, and then using the HTTP protocol to use these features. This is the basic concept of service oriented, however, there are some shortcomings in front of the service, many times, can not accurately predict what users need. So always add new interfaces and constantly modify the returned objects.
Another approach is the so-called resource-oriented architecture (ROA), exposing the resources of Web services, and enabling users to query the resources in real time, with the ability to represent data and consolidate data. Similar to using SQL to query data in a database. The only difference is that ROA you create a query from a URL.
OData is a protocol that prescribes the characteristics of Web services that expose data. The following passage is the definition of OData
Open Data Protocol, OData, is a Web protocol for querying and updating data that provides a way to expose data that exists in an application. OData is used and built on many web technologies, such as HTTP, Atom Publishing Protocol (AtomPub), and JSON, providing the ability to access information from a variety of applications, services, and repositories. OData is used to expose and access information from a variety of data sources, including but not limited to: relational databases, file systems, content management systems, and traditional web sites.
Overview of the OData protocol
As mentioned above, the OData service discloses the resources provided through a Web service. You can then access these resources through a URL. The OData protocol indicates how to query data over HTTP. The basic principle is that you can enter some URL with parameters to query the resource.
Here are some of the OData public services you can use, and more OData services you can use, which you can access by visiting OData's website.
Http://services.odata.org/WebSite/OData.svc/
Http://services.odata.org/OData/OData.svc/
Http://services.odata.org/Northwind/Northwind.svc/
These exposed OData services will be used when introducing queries using the OData protocol. Below with http://services.odata.org/Northwind/Northwind.svc/
For example, enter the URL in the browser and you will see
From the image above you can see that the service offers products, advertisements, Categories, suppliers these resources. These resources can be accessed by entering the following URLs. For example:
Http://services.odata.org/Northwind/Northwind.svc/Products
Http://services.odata.org/Northwind/Northwind.svc/Categories
Http://services.odata.org/Northwind/Northwind.svc/Suppliers
These queries will return all data based on the Xml-atom format for that resource. For example, the following figure is the data for products.