Diy.netorm Framework--integral analysis

Source: Internet
Author: User

First, the story

has been developing in recent years MISsystem, usedPB,VB,C#and now I've been studying for half a yearJava, who had earlier heard that. NETand theJavahas been to learn from each other, together to upgrade, are to make the program development tends to be simple, colleges and universities, and this is inevitably used in the framework, onJavamany frameworks in the implementation of principles, I am also interested in this series of blogs are, we will be together to achieve a simple. NETversionORMFramework.

Some people will have doubts, there are a lot of mature online ORM frame, why not directly use, just want to do one yourself?

For this answer, is the question of the people, it is like building a building, if he stayed in will follow the blueprint to build a house, he must be a worker, and if he can understand the principle of the drawing, then he must be a manager, when he understood the principle and can draw a blueprint himself, he is the designer!

Second, technical understanding

1. What isORM?

ORM, i.e. object-relationalmapping (Object Relational mapping), which functions as a mapping between a relational database and a business entity object, so that we do not need to deal with complex SQL statements when we operate the business objects in concrete form. Simply manipulate the properties and methods of the object.

2.ORMPros and cons




Expand and talk.

Advantages:

( 1 ), hiding the details of data access .

"closed" Universal database interaction, the core of ORM. He makes our universal database interaction simple and easy, without having to think about the damned SQL statements at all. Rapid development, resulting from this.

( 2 ), ORM makes it easy to construct a solidified data structure.

recall that we did not ORM years, we have to write a variety of SQL statement, we get the data content, we want to convert to the object, we write for a field value wrong Bug I don't sleep all night, now, basically all ORM frameworks provide the ability to construct relational database structures through the object model. and this,"too good!!!" ".

Disadvantages:

( 1 ) Sacrificing performance:

Inevitably , automation means mapping and associated management, at the expense of performance (early, this is all not like orm people in common). Now the various ORM frameworks are trying to use various methods to alleviate this block (Lazyload,cache), the effect is still very significant.

( 2 ) Query Language:

Object-oriented query language (X-QL) as a transition between databases and objects, while hiding the business abstraction at the data level, it does not completely mask the design of the database layer and will undoubtedly increase the cost of learning.

( 3 ) Complex query:

for complex queries, ORM is still powerless. Although it can be achieved, but not worth it. The view can resolve most calculatedcolumn,case, group,having,order by, exists, but the query condition (A and B and not C and (d Ord)) Some of us have to think about and re- Write SQL statements!

 

summary: Anything in the world is perfect , any advantage behind is hidden Disadvantage This is inevitable How to balance their amount In the case of Jane's business, simple 30% is probably the best choice, and in some complex business logic, a large development team project, orm But it's a problem that has to be considered, What to do? It depends on how you weigh it, no one says orm Don't let the bottom people write sql statement ...

.

Third, the concept of modular design


Iv. Summary of this article

This paper briefly describes the basic idea of ORM Implementation and the advantages and disadvantages of ORM Framework and how to analyze and apply it rationally in the project. We use the ORM framework to solve the problem, but, not all of the problems are a framework can be solved, database encapsulation,ORM Just do the work, do not think this thing is how advanced, as our code continues to advance, We design the continuous improvement, in fact, we can find that all the code is a combination of basic technology, but we are not familiar with his combination form, believe in themselves, the framework we can also write!

Accessories (Series Blog links):

1, diy.netorm framework--integral analysis


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.