Classic articles and comments on ORM discussions in the park

Source: Internet
Author: User

Consider integrating An ORM framework to easily index the data found for your reference.

Net open-source project introduction and resource recommendation: Data Persistence Layer
A brief but good description of. Net's common Orm. A good summary and guidance.

Orm hard Injury
It is the most talked-about post to refute the "ORM defect theory. The author believes that the real problem of ORM is domestic. net.ProgramThe staff's OO skills are insufficient. The post owner especially emphasizes that there is no problem with "performance and complex queries.
ROBIN: I personally think whether there is a problem with "performance and complex queries" remains to be verified. Therefore, I recommend that you use dbhelper to perform complex queries, which is effective directly.

O/R Mapping, trap or apple?
The reflection on ORM is more in-depth here. Before using Orm, it is worth considering.

Large-scale software development and ORM Architecture
This post provides some guidance on the pre-Research and verification requirements for the selection of ORM. There is a good description of the pre-Research and verification of the use of new technologies, that is, the Risk Control of new technologies.
Robin.

Once again, I will summarize various points of view on the domain model.
This post is the most in-depth Chinese post on the design of Domain Models. It is worth looking.
This article mainly discusses the classic problem of the "anemia model.
An example is provided. Note that in the "rich domain object", domain does not depend on Dao.
ROBIN:
1. I feel like most of my friends with NH are written as the "anemia domain model", that is, the entity object only has no data action. (This is also a problem that I have doubts and cannot be fixed at present ). This is certainly not a good design from Oo's intention (Object = "Data + action" encapsulation. However, after ORM is used, domain object accesses Dao if the object includes actions, which leads to bidirectional dependency.
2. There are still doubts about the hierarchical design. To be verified.

Which of the following two designs of persistence classes in nhib.pdf is better?
This article discusses the issue of object operations and whether data should be stripped during the design of persistence classes in nhib.pdf. It provides two implementation methods, which are worth your reference. The discussions in the replies are also very valuable.
ROBIN: the first method is used in the anemia domain model. Castle activerecord uses the second method.

System architecture using nhib.pdf
The post provides a layered design that compares the "traditional" NH, which has a certain reference value.
ROBIN: the reference of domain and domain to NH Dao In the UI is controversial.

Enterprise persistence design
This post gradually analyzes and explains the intention of ORM, and discusses the principle of hierarchical design of service/domain/Dao, which is recommended.
ROBIN: the Hierarchical Design Based on this theory is basically the classical method of hibernate: the anemia domain model. However, the post author emphasizes that "what should not be done (separate persistence from business), what should be done (implement business), and what can't be done by others (delegate, fa çade) ", very meaningful (pay attention to understanding English, better reflect the intention ). Brother of the "Summary of the various viewpoints of the domain model again" believes that the design persistence action is put on the service, and the persistence action is not involved, and the domain action is suitable to be put on the domain. This is a reference, but the actual results need to be verified. Discussion: Can Dao be omitted to call the NH interface directly in the service to fulfill the responsibility of persistence objects? (But this is similar to the transaction script)

From my personal experience, I have some opinions on Orm.
The post assumes that "It is the right way to use ORM to map objects to the database first. ". Currently. netCommunityThe root cause of the debate on ORM is that R (database) and O (object) are the root cause of this fundamental incorrect application method, it is also the root cause of "ORM defects.
ROBIN: This is worth considering and analyzing. However, whether "first O and then R" is applicable in actual development remains to be verified.

O/R Mapping
The post raised the question of "first O then R" or "first r then O. It is believed that the value of ORM is that it can support you to "consider issues from the object-oriented perspective". That is, the domain model (o) is created first, and then the table design (R) is directly exported through the Orm ).
ROBIN: this seems to have raised the "ultimate value" of ORM. But I feel that there is a lack of verification (the followers also raise questions ). I personally have doubts about whether O and R are actually feasible. After all, database design is a very professional task that requires some skill. A good table design requires skill, especially in terms of performance improvement. Can I map the tables that should be carefully designed? Suspect. The more practical practice is to "use oo for domain model design first, and then refer to the domain model to complete database design". In the database design stage, some professional design skills will be applied, which cannot be reflected by the object.

O/R Mapping again
"Ms focuses on data and Java focuses on action (logic)". This post explains why. there are so many confusions When Using ORM on. NET: the previous steps on the MS Platform are not implemented by Oo, and they are always in the form of table modules and transaction scripts.
ROBIN: this is indeed the case. Most of the brothers on the Microsoft platform, even if they use oo languages such as C #, use class as the sole class of a transaction. Over the years, many applications have been written.
I personally think that it is necessary to use Orm. Do you need to switch to the real OO Writing Method? It needs to be verified based on the actual situation of the company-can it improve efficiency and design? Are there any designers competent for OO design? How high is the learning cost of OO thinking of developers? We need to consider an investment and income issue, not for OO and OO, but for Orm.

End unnecessary discussion.
This brother tried to end the ORM debate. I think that if your writing method is not Oo at all, there is no need to discuss Orm.
ROBIN: This involves the question of "The Domestic. Net programmer's OO skill is not enough. This is indeed the problem. However, I personally think that even if the OO skill is not enough, Orm is also meaningful. At least it can be used as a fast-developedCodeGenerator (such as castle activerecord ). In addition, it is true that Using ORM and OO has high requirements on the team's design capabilities. If the design capabilities cannot keep up, instead, it is more effective to directly use the "Table module" and transaction script.

Data transmission object (DTO) in Distributed Application Architecture)
The common DTO implementation methods and their advantages and disadvantages are well described for reference.
. NET 2.0: entity as DTO vs dataset as DTO/XML serialization vs JSON serialization
There are actual tests here. Dataset is considered to be a good DTO solution.
Po, Vo, DTO ....
Po, Vo, DTO.
ROBIN: personal disposition and use of datatable and scalar. It is better not to write the DTO object or serialize the object by yourself. Some brothers say that in the "anemia domain model", domain objects can be used as DTO (domain objects without persistence responsibilities) for reference, but they always feel that domain objects should not be exposed to the UI, application Service separation is a good design.

 

1. Orm will not bring any shortcuts to Business Layer Development (compared ).
2. Orm performance problems, so that it cannot even be used in a medium-sized service (relative)
3. Orm makes it easy for developers to understand databases.
In short, for small applications, I think subsonic can be used to meet the requirements.

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.