Datarabbit lightweight data access framework (12)-integrate datarabbit into the architecture

Source: Internet
Author: User
Summary of my Architecture Experience (III)-deep into the three-tier architecture article, we will discuss the three-tier architecture in detail. This article will introduce how to integrate datarabbit into the three-tier architecture.

Datarabbit includes three projects: datarabbit. Basic, datarabbit, and datarabbit. application. Their hierarchies are as follows:

Datarabbit. Basic provides some basic element definitions, such as the ismartentity interface and entityattribute features.
Datarabbit is the core of the datarabbit framework. All data accessers are defined and implemented in it.
Datarabbit. application is mainly used to encapsulate applications, such as transactionscope and transactionscopefactory.

Generally, the three-tier architecture includes the UI Layer, BL (business logic) layer, and data access layer (corresponding to the BEM layer in the figure ). The entity layer does not belong to a three-tier architecture (for this reason, I call it a "side layer"), but it transmits data between layers through entity object. Therefore, the UI, BL, and BEM depend on the entity layer.
The entity side layer must reference datarabbit. Basic Program Set to implement the ismartentity interface so that the entity can be "smart. Note that the entity side layer does not need to reference the datarabbit or datarabbit. Application assembly.
Bem layer is the common data access layer. Because it needs to provide core data access capabilities, it must rely on the datarabbit assembly, which uses datarabbit for data access. In addition, bem usually needs to be executed in the transaction context, so it needs to use the transactionscope class defined in datarabbit. application.
The BL layer is used to start a transaction and execute a complete business flow. Therefore, it depends on datarabbit. application. Note that the BL layer does not need to reference the datarabbit. Basic and datarabbit assembly.

It briefly reflects the dependency After integrating datarabbit into the three-tier architecture:

In practice, I wantStrictly abideThe preceding dependency must not contain cross-layer calls or dependencies not specified in the figure.CriticalAnd advantageous.

(To put aside a few questions, a lot of friends asked me to give a complete example of using datarabbit. I am very grateful to my friend getsun for helping me complete this, you can download all the documents and source code of the example here .)

Go to: datarabbit lightweight data access framework-Sequence

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.