Practical application of OData-building rich Internet applications through open data protocols

Source: Internet
Author: User
Tags web services silverlight

During PDC09, the Microsoft WCF Data Services Team (formerly known as the Data Services team) launched the first OData, the Open Data protocol. The news was announced in a keynote speech on the second day of the meeting, but in fact OData had already begun. Since providing data services in the Microsoft. NET Framework 3.5 SP1, users who are familiar with data services have developed resource-based applications using OData as a data transfer protocol. This article describes how developers of rich Internet applications (RIA) can use OData and the advantages of using OData.

First of all, I will answer the number one question that I have often been asked since the advent of OData in November. What is the problem? Simply put, OData is a resource based WEB protocol for querying and updating data. OData defines the operation of resources using HTTP verbs (Put, POST, UPDATE, and DELETE) and identifies these resources using the standard URI syntax. The data will be transmitted over HTTP using the AtomPub or JSON standard. For the Atompub,odata protocol, a number of conventions are defined above the standard to support the exchange of query and schema information.

OData Ecological System

In this article, I'll introduce a few products, frameworks, and Web services that use or produce OData sources. The Protocol defines the resources and methods that can be manipulated, and the actions that can be performed on those resources (get, PUT, POST, merge, and delete, respectively, for read, create, replace, merge, and delete).

In fact, this means that any client that can use the OData protocol can operate on any producer, and there is no need to learn the programming model of the service to program for the service, as long as the target language of the programming is chosen.

For example, if you are a Silverlight developer who is learning the OData library for this platform, you can program for any OData source. In addition to the OData libraries that apply to Silverlight, you'll find libraries that apply to Microsoft. NET Framework clients, AJAX, Java, PHP, and Objective-c, and more libraries are being rolled out. In addition, Microsoft PowerPivot for Excel also supports the option of importing a OData source as a data import into its in-memory analysis engine.

Just as a client that can use the OData protocol can operate on any producer, a service or application created using OData can be used by any client that has enabled OData. After you create a WEB service that exposes relational data as a OData endpoint (or exposes data in a SharePoint site, Windows Azure table, or other services that you use), you can easily build a rich desktop client in the. NET Framework, or build a Rich AJAX sites with the same data.

The long-term goal of OData is to build a OData client library for each of the mainstream technologies, programming languages, and platforms so that each client application can use a rich OData source. OData's producers and users together constitute the OData "ecosystem".

New features of WCF data Services

The WCF data Service as a. NET framework component is a framework that provides turnkey solutions for creating OData Web services. It includes a client library that you can use to build a client that uses the OData source. The WCF Data Services team recently released an update to the. NET Framework 3.5 SP1, introducing a series of new features that will be rolled out in the. NET Framework 4. This is the second version of the Data Services framework. Please visit Data-services-update-for-net-3-5-sp1-available-for-download.aspx, here you can find the relevant introduction and download links.

The WCF Data Services framework is not only a protocol for RIA applications, but also for advanced service developers. It has many attractive features, such as server paging restrictions, HTTP cache support, stateless services, streaming support, and pluggable provider models. Let's take a look at the new features that attract most RIA developers.

After the initial release, one of the most desirable features of the user is the ability to request the number of entities in the set. The new "Count" feature meets that requirement in two ways. First, it lets you only request a count, that is, the number of values that a query can return. Second, it adds a query option that tells the service that when the query result is a partial set (for example, server paging is enabled), it includes a count of the total number of entities in the set.

To improve the experience of binding data from the OData service, a new type dataservicecollection has been added to the WCF Data Services client library. This type implements change tracking for the entries it contains (by using the INotifyPropertyChanged and inotifycollectionchanged interfaces). If you bind it to a control (such as a DataGrid in Silverlight), it tracks changes to the object and the collection itself. This new collection greatly simplifies the process of creating OData clients using interface components.

Another feature that users expect is a subset of the attributes of the entity that the result of the query returns. LINQ support has been added for this purpose, and this support is implemented through a LINQ Select statement. There are two benefits: you can reduce the size of the HTTP query response, and you can reduce the amount of memory consumed by client-side objects. This is especially useful when you are developing a client application for someone else's service, and each entity in the service has many properties that are not meaningful to the client. I'll show you how to use a large public service with many entities, each entity, and countless attributes in the following article. The projection in the example is useful because it includes only a few of the required attributes on one entity.

To help you understand the value of the OData ecosystem, we will create a Web application that allows visitors to browse the Web site of a virtual real estate company, Contoso Ltd, to view its Managed property sales list.

Related Article

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: 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.