Micro Project Practice (5): Business Layer Code Analysis--Entity base class

Source: Internet
Author: User

In the previous article, we analyzed several classes in the common, which are all auxiliary, in fact not very important, so that we have to analyze these categories today, including entity, Idatabase, ientitydataaccess, Entity, which is the base class for all entity classes, is the most important, while Idatabase and ientitydataaccess are services for the entity class.

First look at the familiar system structure diagram.

The three types of Entity, Idatabase, Ientitydataaccess are located in the business layer. The current class diagram for this layer is as follows:

As you can see from the diagram, the business layer contains both the blog and Blogclass entity classes, both of which inherit from the entity class, and each entity class (including entity) corresponds to a entension class. This class is naturally the place where the class-related extension method is stored, typically an extension of the IQueryable and Ientityaccess interfaces, and the Idatabase and ientityaccess two interfaces define methods for database access.

First, entity class. Entity is the base class for all entity classes and is a generic class in which a template class cannot be a struct body. It provides IDs, timestamp, and IsNew properties for all entity classes, Validate, save, and delete methods, each containing the actual operations validateaction, Saveaction, and Deleteaction.

Related Article

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.