Spring.net Enterprise Architecture Practice (III.)

Source: Internet
Author: User

Nhibernate + WCF + asp.net MVC + nvelocity PetShop4.0 Refactoring (iii)--persistence layer

What is a persistence layer? First, explain what is persistent, English persistence, solidify the data in memory and keep it in the physical storage device. However, in enterprise application, it is often through relational database to complete this process. The persistence layer is defined as a separate domain dedicated to persisting data relative to the presentation layer and business layer in the three-tier architecture. The "single responsibility" principle in the design pattern defines the purpose of layering, and the persistence layer is specifically dealing with the database. As shown in Figure 1

Figure 1

The DAL (Database access layer) in PetShop4.0 is the operation database. In its DAL, returns DataReader through an SQL statement, assigns a value to the model object, generates an SQL statement from the model object's data in the Add, modify, delete operation, and writes to the database. At this point, we can see that each table is doing the same thing. Although PetShop4.0 uses SqlHelper to encapsulate database operations, it does not have a common crud package. Currently PetShop4.0 each table corresponds to a variety of crud, so there will be a lot of duplicate code.

For PetShop4.0 use of multiple clock database to speak. A DAL is written for each of the databases. So the database portability is not strong.

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.