Summary of step by step. Net three-tier Architecture Analysis Series

Source: Internet
Author: User
Tags in domain

Original Site: http://www.cnblogs.com/springyangwc/archive/2011/03/30/2000388.html

I have written eight articles in this series, from what is a three-tier architecture to a simple three-tier architecture, from database design, sqlhelper design, modle design, Dal design, BLL design
I made a simple description of the UI design. Many readers have made great comments here. I am very happy. I just wrote down my understanding and shared it roughly, let's review the summary of some previous projects.
I hope I have some inspiration in this regard, and I also accept criticism from readers to improve myself.

Step by step. Net three-tier Architecture Analysis Series

Step by step. net three-tier Architecture Analysis 1. What is a three-tier architecture. net three-tier Architecture Analysis II. database design step by step. net three-tier Architecture Analysis III. sqlhelper design step by step. net three-tier Architecture Analysis 4. Model Design (four design methods) step by step. net layer-3 Architecture Analysis V. Design of dal and idal step by step. net layer-3 Architecture Analysis VI. BLL design step by step. net layer-3 Architecture Analysis 7. UI design (login page, registration page, and add Department page. net three-tier Architecture Analysis 8. UI design (the design of the gridview and its paging)

Thank you for your support and valuable suggestions. Source code download

In the meantime, some of the better comments (I personally think) are listed below:

1,Potato barbecue
For complex projects, you can consider using domain model design. There are many open-source projects in this regard. MVC musicstore also adopts similar design ideas.

If you use the domain model design idea, you can focus on the domain model and the business logic related to the model. Data Persistence, metadata interaction synchronization, and UI display can all be separated.
There are mainly the following layers:
Domain Layer --- domain model layer (I am using a blood-filled Model)
Infrastructure layer --- base layer (including data persistence of the model, proxy for interaction with the network element, and basic class for interaction with the file system)
Task layer-service provision layer (services provided to the ui or other network elements, such as query and CMD)

In this case:
Brothers who write domain models can specialize in Domain Models and businesses.
The brother who writes data persistence, As long as writing data persistence, generally uses ORM for mapping. If you are interested, you can use NH 3 or EF 4.1. These two have better support for DDD, relatively pure Model

There are generally two types of data interaction between the ui or other network elements and the system:
Query and Data Change

Therefore:
Create the corresponding DTO object, obtain DTO data from the service provision layer, and display the UI
Create a command object and pass the CMD object from the ui or network element to the service provision layer. The service provision layer calls the relevant basic layer or domain model service to implement data change.

In this way, the domain model object is completely separated from the UI and other network elements, so that the business logic is highly aggregated in the domain model.

IOC can be used between each layer to achieve the discrete coupling between the layer and the layer.

For data caching, logging, and exception handling, you can use AOP to implement these common methods. If you are interested, you can check postsharp.

Probably like this.
2. RHS

The example given by the blogger is too simple to reflect the significance of the BLL layer.
First, the verification is too simple. In addition to checking whether the Department value is null, adding a department name and department number at the same level in BLL cannot perform the same verification.
Second, the example basically does not reflect the business logic, so it is no wonder that the above has been opposed.
I suggest you use a tree structure to better express your business logic. 3. Gray Zhang 1. Your previous articleArticleSomeone has already mentioned that you didn't distinguish between data and business. How does the landlord distinguish between a method, a data or a business, and what principles and conventions are there?
2. As mentioned above, there are interfaces but they are directly implemented when called at the BLL layer. What is the significance of interfaces?
If these two problems cannot be solved, I cannot say a good sentence. I personally think that this article is not taught by many people on the home page, but it will hurt people.

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.