What is o/R Mapping (ORM )?

Source: Internet
Author: User

Orm, that is, object-relationl mapping, is used to map between a relational database and an object. In this way, when we operate a database, you don't need to deal with complex SQL statements, as long as you operate on objects as usual. Below is a reprinted section on the InternetArticleDescription of it:
Let's start with O/R. The letter O originated from "object", while R came from "relational ). Almost allProgramObjects and relational databases exist. In the business logic layer and user interface layer, We are object-oriented. When the object information changes, we need to save the object information in the relational database.
When you develop an application (do not use o/R Mapping), you may write a lot of data access layerCodeUsed to save, delete, and read object information from the database. You have written many methods in the Dal to read object data, change State objects, and so on. These codes are always repeated.
If you open your recent program and look at the Dal code, you will certainly see many similar general patterns. Let's take the method of saving objects as an example. You pass in an object, add sqlparameter to the sqlcommand object, map all attributes to the object, set the commandtext attribute of sqlcommand as the stored procedure, and then run sqlcommand. This code must be repeatedly written for each object.
In addition, is there a better way? Yes. Introduce an O/R Mapping. Essentially, an O/R Mapping will generate a dal for you. It is better to use o/R Mapping than to write the Dal code by yourself. You use o/R Mapping to save, delete, and read objects. O/R Mapping is responsible for generating SQL statements. You only need to care about objects.

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.