ASP. NET MVC principle

Source: Internet
Author: User

I have a test paper for an interview, one of which is asking for the principle of ASP. The feeling is too vague, who can say?

However, if I stand in the position of the interviewer, the question is not required to have a standard answer, there may be no answer, mainly through questions and answers, to understand the interviewer's understanding of the extent of the relevant knowledge or something. In fact, my own level is not good, but because of age, as if not with some people will feel a bit strange, so in the past a period of time to participate in the recruitment work.

For ASP. NET MVC, my own understanding is Jiangzi:

MVC is an idea. ASP. NET MVC is just a development framework that implements this idea. Using Web Form projects, you can actually implement MVC. I used to be a web FORM and I tried MVP mode.

The idea of MVC is to separate the UI from the business logic and data. The advantage of logic is clear, the second is conducive to logical reuse and testing. Because the UI is difficult to automate testing, logic can. So, ASP. NET MVC facilitates unit testing. And after the UI is separated from logic and data, it is easy to reuse. For example, in ASP. NET MVC, different action can point to the same view.

In classic MVC, model is a Big Mac that contains business logic and data. The controller is just an intermediary, passing points between the view and model, playing soy sauce. Sometimes the model and view are even directly connected, bypassing the controller.

in ASP. NET MVC, although there is a model, this model is not the Big Mac model. The model in ASP. is a view-related model, the legendary Vm,viewmodel, which is only part of the classic Big Mac model. ViewModel, as the name implies, is mainly used for view. The classic Big Mac model is split into data (ViewModel, domain objects, database entity classes) + Business logic (BLL, various services). Therefore, model is just a collection of concepts, not a real object.

It is worth mentioning that ViewModel, domain objects, database entity classes are most likely the same object. For example, the VMS that we operate directly in view are often used to directly take the entity classes of the data persistence layer. Even so, in the software design phase, they are to be separated from their conceptual areas.

The principle of ASP. NET MVC is to use HttpModule and HttpHandler to intercept the user's request, interpret the corresponding controller and action according to the set routing rules, and execute it. Module is a more macroscopic concept, such as session, cache are responsible for the corresponding module, and handler is responsible for processing the specific request. There are module first, then there is handler. Their relationships are a bit like processes and threads.

Copyright NOTICE: This article for Bo Main original 屙 article, like you take away.

ASP. NET MVC principle

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.