Active record pattern and ORM

Source: Internet
Author: User

Active record pattern is famous for Ruby on Rails. The method of using typed dataset for a wide range of ASP. NET streams is actually active record pattern.

Because typed dataset has many drawbacks and is not a pojo entity, I was denied at the beginning, but unfortunately, I also denied active record pattern.

In fact, this mode is quite successful on the premise of "database-driven web system. Because entity life cycle in such a system can be very short.

  • A life cycle is generated from the database and ends on the binding interface.
  • Another life cycle starts from collecting user input and ends with saving it to the database.

In the database-driven web system, adding active record pattern with the lightweight pojo entity is very suitable.

There is nothing wrong with the concept of domain driven design, but do not forget to further refine the application premise, such as what the model should look like on the web. The entity of the system model may not be directly used in the web system. The OOP principle advocated by gof is "favor interface over base class ". The core meaning is to focus only on the part that must be known in the system. It is also necessary to design a lightweight entity for different application scenarios.

This requires lightweight Orm. Load the database data into entity, and save the data in Entity back to the database. Lightweight is only this function. Do not attempt to manage entity life cycle, do not pursue container level transaction, or create an application server.

In fact, MS is aware of this and will include Entity Data Model (EDM) in the next generation of ADO. net, see the ADO. NET Entity Framework overview. Canceling the release of object space several times does not mean that it is not important, but that it is so important that it must be placed in a more appropriate location, such as the. NET core location, ADO. net. This makes the fans of Typed Dataset speechless.

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.