. NET completely manually build three layer B/s architecture

Source: Internet
Author: User

Summary: The three-tier architecture (3-tier application) typically has a three-tier architecture that divides the entire business application into: The presentation layer (WebUI), the Business Logic layer (Businesslogiclayer), the data Access Layer (Dataaccesslayer), Public layer (Modellayer). The purpose of distinguishing hierarchy is to "high cohesion, low coupling" thought.

First, the advantages of applying three-tier architecture

Three-layer structure is suitable for group development, each person can have different division of labor, work together to maximize efficiency; Each module to reduce the capacity requirements of developers, to facilitate the expansion of system functions and later maintenance work; The biggest advantage is its security. The client can access the data layer only through the logical layer, reducing the entry point and shielding many dangerous system functions. Can better support the distributed computing environment. The logic layer of the application can be run on multiple machines, taking full advantage of the network's computational capabilities. The potential for distributed computing is huge, far more effective than upgrading CPUs.

Second, manually build three-tier architecture

software VS .

(You can use soft, of course.) NET code generator, etc. to automatically generate a three-tier architecture)

1. Create a Blank Solution

Act 1) File/new/Project Popup dialog box select the Visual Studio solution under Other project types, click the Blank Solution Name: Ling Location: d/Finalize blank scheme setup

Method 2) Shift+ctrl+n Popup dialog box select "Other Project Types" under "Visual Studio Solutions"

2. Set up three classes of libraries

1) In Solution Explorer, right-click on "Solution Ling" and select "New Project" under "Add"

2) in the popup dialog box, select "Class Library" in "Visual C #"

Name: Modellayer (abbreviated model) common layer Location: d:/ling "OK" to complete the addition of a class library

Create the following two class libraries in the same way:

Name: Dataaccesslayer (abbreviated DAL) data Access Layer location: d:/ling

Name: Businesslogiclayer (abbreviated BLL) business Logic Layer Location: d:/ling

3. Create a presentation layer

In Solution Explorer, right-click Solution Ling, select New site under Add

In the pop-up dialog box, select "ASP." Location: File system, D/ling/webui

Language: Visual C # (the path to the Web site is noted here: D/ling/webui)

"OK" completes the presentation layer construction

So we're done with the basic structure.

4. Add a reference between layers

4.1 Data Access Layer (Dataaccesslayer) reference to common layer (Modellayer)

1) In Solution Explorer, right-click on "Dataaccesslayer" and select "Add App"

2) Popup "Add Reference" dialog box, click "Project" to select "Modellayer"

Click OK to complete the reference to the common layer

4.2 Business Logic Layer (Businesslogiclayer) references to Dataaccesslayer and Modellayer

1) In Solution Explorer, right-click on "Businesslogiclayer" and select "Add App"

2) Popup "Add Reference" dialog, click "Project" to select "Dataaccesslayer, Modellayer"

Click OK to complete the dataaccesslayer and Modellayer references

4.3 Presentation layer (WebUI) to Businesslogiclayer, Dataaccesslayer, Modellayer references

1) In Solution Explorer, right-click on "d/ling/webui/" and select "Add App"

2) Popup "Add Reference" dialog, click "Project" to select "Dataaccesslayer, Modellayer, Businesslogiclayer"

Click OK to complete the dataaccesslayer, Modellayer, businesslogiclayer reference

This way our project can not be run, do not believe themselves to try.

5. Set the start Item and start Page

1) In Solution Explorer, right-click on "d/ling/webui/" to "Set as Startup Project (A)"

2) In Solution Explorer, click "Default.aspx" (default, can rename) in "d/ling/webui/" and right click "Set as Start Page (P)"

3) In Solution Explorer, right-click the solution Ling and then "rebuild Solution (R)"

OK, so the completion of a three-storey B/s framework. As for the specifics of the implementation of the details are not discussed here, to change the sky again.

Original link:. NET completely manually build three layer B/s architecture

. NET completely manually build three layer B/s architecture

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.