Developing a unified data access model with Dojo

Source: Internet
Author: User
Tags json

At present, the amount of data within the enterprise is rapidly expanding, and the data format exchanged between client and server is also varied. Due to the rapid development of Web2.0 and RIA, processing data on the client is becoming a trend, but the general Ajax client program based on XMLHttpRequest must be written by the Web developers themselves to handle the various data formats. This not only aggravates the complexity of client logic, but also reduces the maintainability and scalability of the program. The Dojo data Library is designed to provide a unified data access model for different data formats, so that the data can be read and written in a unified interface, which facilitates the transplant and maintenance of the program. Read this article to see how the Dojo Data library works and to use the repositories provided by Dojo for a unified data Model application development.

Overview

Compared with traditional models, service-oriented Internet applications provide a faster and more convenient way to publish and process information. Its distributed and loose coupling characteristics are also favored by more and more enterprises. With the development of the enterprise, the data volume of the application is often a rapid expansion of the geometric scale, the data format exchanged between client and server is also various, common such as json,xml. With the development of Web2.0 and RIA, processing data on the client is becoming a trend, but the general Ajax client program based on XMLHttpRequest must be written by the Web developers themselves to handle the various data formats. This not only aggravates the complexity of client logic, but also reduces the maintainability and scalability of the program. The Dojo data Library is designed to provide a unified data access model for different data formats, so that the data can be read and written in a unified interface, which facilitates the transplant and maintenance of the program.

This article describes how the Dojo data library works, and the common APIs, and combines a specific scenario that describes how to use the Dojo.data.ItemFileReadStore and Dojox.data.XmlStore repositories provided by the Dojo Data library to To achieve the WEB client data acquisition, paging, sorting, filtering and lookup functions, and finally briefly introduced the Dojo data library Write API.

How Dojo Data Works

In rich-client applications, the data formats exchanged by the client and server are varied (such as json,xml, etc.), so a client-based unified data access layer becomes the basis for rich client applications. Dojo provides a number of repositories to access data in different formats, such as Dojo.data.ItemFileReadStore (used to read JSON files), Dojox.data.xmlstore,dojox.data.atomreadstore,dojox.data.csvstore, and Dojox.data.OpmlStore and so on. The goal of Dojo data is to provide a unified data access interface for different client applications or widgets to achieve interoperability purposes, while various client applications do not need to know the exact format of data such as JSON, XML, CSV, and so on. Data can be accessed and manipulated easily through a unified access interface. Simply put, we can interpret dojo.data as the data parsing layer on top of dojo.xhrget (). By contrast, Dojo.xhrget () is only responsible for reading data asynchronously, and Dojo data resolves the specific data into a generic data access model (data item and its attributes). As shown in the following illustration:

Figure 1.Dojo Data structure diagram

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: info-contact@alibabacloud.com 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.