ORM tool: nhib.pdf (1) Introduction, ormnhib.pdf

Source: Internet
Author: User

ORM tool: nhib.pdf (1) Introduction, ormnhib.pdf

Introduction:

Object Relational Mapping.


Why is ORM?

Object-oriented features: The development language Java and. Net we usually use are object-oriented. The object is encapsulated with attributes and methods.

Features of relational databases:Organize our data in the form of tables. Table features are expressed in the form of columns. One record in the table is an object, and the columns in the table represent the attributes of the object. There is a certain relationship between tables.

How can a record in a table be extracted and encapsulated into an object?In the past, we used the corresponding SQL statement to query records, and then retrieved each piece of data in the records to instantiate an object and send it to each attribute of the object, to encapsulate objects. In this way, a piece of data is converted into an object.

Put the object through CRUD in the database?You need to execute DML statements on the database, spell various SQL statements, and convert one form to another. You need to manually implement the code. If the project table has many structures, repeated object and database conversions are prone to errors. Programmers are more suitable for object encapsulation, rather than frequent database switch and database DML. Is there any better way? That is the appearance of ORM. ORM is a bridge between databases and objects, describing the conversion relationships between two different forms.

 

Working principle:

By using metadata that describes the ing between objects and databases, ORM automatically persists objects in the program to relational databases.

ORM automatically performs the following operations: 1) Place the object in the table through CRUD and display it in the database. 2) package the database into an object through DML statements and return it.

In the. Net three-tier architecture, the top presentation layer (U layer), the middle business layer (B layer), and the following data access layer (D Layer ). In previous projects, what is the common use of layer D? DAO and DAL indicate that they are responsible for all the places where they are dealing with the database. CRUD is implemented by manually encapsulating DBHelper. There are many database types. If the product needs to be well-developed, it needs to support different types of database drivers and write different D-layers. You can define an interface for different data sources. However, the D-Layer Code will be very huge. If there are many different types of libraries, there will be a huge D-layer code. How can this operation be saved? ORM aims to be persistent and act as a layer for dealing with databases. The corresponding statements are automatically converted to databases of different types.

  

The nhib.pdf code is very complex. Here we only provide basic use.

5th percentile


Summary

Nhib.pdf implements the ORM framework, developed by the Java open-source project Hibernate. It provides a persistent class (layer D) for object-oriented development, solving the problem of mutual conversion between objects and databases. It also provides APIs to implement mutual conversion between objects and different types of databases and is universal.

This article only gives a brief introduction to the study of NHibernate, and the series of blogs will be updated continuously. We look forward to O (∩ _ ∩) O ~



What is the orm framework of nhib.pdf? What can we do?

Not all applications are very suitable. From this point, performance depends on hardware.

Nhib.pdf is widely used

Nhib is an object/Relational Database ing tool for. NET environments. Object/relational Database ing (object/relational
ORM ing, ORM) This term represents a technology used to map the Objects represented by the object model to the SQL-based relational model data structure.

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