Why do we use Orm?

Source: Internet
Author: User
Blog Park has made great contributions in promoting Orm, and a lot Program They started to use Orm, and they were excited by the joy of not writing SQL. However, it was not a long time and they soon found that many troubles appeared one by one.

Sorry, I am not planning on thisArticleTo solve these problems, because there are indeed these problems, and there is no perfect solution at present. In this case, why should we use Orm? Is it true that SQL is not used?

We still need to look at O-R. Why do we need to convert relational data into objects? Isn't the dataset method good? The performance is consistent with that of the database. It is simple and convenient. Why should our predecessors convert them into objects.
We know that objects can be inherited and interfaces can be used, but relation does not. Because of this, we have designed an object as an object method, which gives us a lot of advantages.
For example, I can check whether the object supports the iversionobject interface in the program. If yes, we will automatically implement version control. If you give me a dataset, then I will not be able to detect (do not tell me whether the version field exists ). With this feature, we can automate many things.
For another example, I designed a base class for the document entity, including the sheetcode, sheetdate, and other fields. Then, my ordersheet inherits from sheetbase and they will automatically get these standard fields, in addition, my basic classes can automatically help me deal with many unified rules to make the program more stable and unified. This relation is very difficult to achieve.

There are a lot of ORM systems on the market. In fact, a lot of systems cannot use the inheritance feature of objects at all. They still have a bunch of ideas about how to implement one-to-many and many-to-many. We did not understand the essence of ORM at all.

here I need to explain several misunderstandings:
1. Orm frees us from SQL, but it does not mean we no longer use SQL. In fact, I still recommend using SQL for complex queries and reports. A good system should be compatible with previous methods.
2. Microsoft has spent countless effort on table model (relation, therefore, the current relation package solution is the most complete and best. But we can see that Microsoft is. NET 2.0 makes it even closer to the support for object binding. With the development of many subsequent technologies such as LINQ and XAML, we believe that the complete solution of the domain model (object) will be more complete;
3. Orm is more suitable for complex systems (complex systems are used here, rather than large systems), rather than small systems, because such systems require fast construction and stable systems, their business rules are extremely complex, but they do not have high requirements on system performance (compared with performance requirements such as China Telecom ).

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.