Solution: What is adding a reference in ASP. NET?

Source: Internet
Author: User

Since we upgraded our duty schedule, the data room charging system has been a must for everyone, and more than once. However, each time has its meaning.

The first time, we used VB6.0. When we saw that this system was produced by a line of work, we had a feeling of unbelief in our hearts.

We have established our interests and confidence. As long as we stick to them, we will be able to succeed.

The second time, with VB. NET, it is hard to redo it several times. We have learned the layering, so we need to experience the benefits of layering.

After more than half a year of separation, we found that the score was not good.

The third time is based on the second time, because this time, we need to experience the joy of cooperative development.

After my previous instructor's explanation, I found that it was like this. But curiosity made me have to think about two demos.

To verify.

First, let's talk about the system's appearance. The system adopts a classic three-tier architecture, and then adds the appearance mode to divide functions into modules.

Abstract Factory and reflection to facilitate database replacement. Is the structural diagram.

 

This architecture creates no dependency between the factory and the Dal layer through abstract factory and reflection. Therefore, the DLL of the Dal layer will not be generated during the generation process.

To the debug of bin in other layers, so that if the Dal layer is not processed a little bit, an error will be reported. Why is the error reported?

I have studied it.

I have used two methods. One is to add a reference to the Dal layer on the UI Layer (which is not desirable, because in the architecture diagram, there is no layer for the dal

Layer. The second is to change the Dal generation path to the bin debug In the UI.

The first method is not advisable because it violates the architecture diagram. However, if I have added a reference to the Dal layer in the UI Layer, write it well.

After the program is packaged, The dal is not just packaged into A. dll file, but the Dal. dll file is packaged into the UI. After the Dal. dll file is replaced, the program

Unable to run. According to the above architecture, that is to say, the original login check in BLL only checks whether it has been logged in. So I will talk about the login party in BLL

To check whether the account exists, and then check whether the account has been logged in. Then, replace the generated DLL with the original one.

Only check if you have logged on.

 
I did an experiment later. Next I will use a simple experiment to clarify this matter.

First, let's build a classic three-tier architecture. The following is the architecture and reference relationship:
The code in each layer is as follows:
UI
Imports BLLPublic Class btnTest    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click        Dim objTest As New TestManage        MsgBox(objTest.TestDemo())    End SubEnd Class

Bll

Imports DALPublic Class TestManage    Public Function TestDemo() As String        Dim objTest As New TestDAO        Return objTest.TestDemo()    End FunctionEnd Class

Dal

Public class testdao public function testdemo () as string return "this is the original Dal layer" End functionend class

 
Package, install, and run the following interface:

Currently, Layer 3 is ordered. If, as the teacher said, if I only make the Dal layer interface consistent, and the code in the Dal layer changes, the program will not be executed, but the fact is that I created a new solution, then re-wrote the Dal, and then replaced the Dal. below is the code in the New DAL layer.

 

 
Then generate and replace it. The running result is as follows:

 

Therefore, this experiment shows that if you add references to the Dal layer on the UI Layer. Therefore, I feel that the reference only copies the DLL to the bin/DEBUG directory in my directory. The reason why I cannot add the reference of the Dal layer on the UI Layer is because it violates the architecture, therefore, the generated path is required.
But what does the reference actually contain? Please enlighten me.

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.