"Anatomy PetShop" Series II: PetShop data Access layer database access design

Source: Internet
Author: User
Tags new features

In series one, I analyze the architecture design of petshop as a whole, and mention the concept of layering. Starting with this section, I will analyze the layers in sequence, in order to get a more detailed and in-depth understanding. In PetShop 4.0, due to the introduction of some of the new features of ASP.net 2.0, the content of the data layer is also more extensive and complex, including: Database access, messaging, membership, profile four parts. In series two, I'll describe the design for database access.

In PetShop, the database objects that the system needs to deal with are divided into two types: one is the data entity and the corresponding data table in the corresponding database. They have no behavior and are used only to represent the data of the object. These entity classes are placed in the model assembly, such as the entity class OrderInfo for the order of the datasheet, whose class diagram is as follows:

These objects do not have a persistent function, simply, they are as a carrier of data, so that business logic for the corresponding data tables for read/write operations. Although the properties of these classes map the columns of the datasheet, and each instance of the object corresponds exactly to each row of the datasheet, these entity classes do not have the corresponding database access capabilities.

Because the data access layer and the business logic layer will operate on these data entities, the assembly model is referenced by the modules in the two tiers.

The second type of database object is the business logic object of the data. The business logic referred to here is not a domain (domain) business logic in the sense of the business logic (in this sense, I prefer to refer to the business logic layer as "domain Logic Layer"), in general, these business logic is basic database operations, including Select,insert, Update and delete. Because these business logic objects have only behavior and are not data-independent, they are abstracted as a separate interface module Idal, such as the interface for a datasheet order Iorder:

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.