Summary
This article, as the end of the ASP.net MVC case course, publishes some views on the ASP.net MVC framework only from a personal perspective. And in the end will be attached to this series of the demo download.
Objective
The purpose of writing this article is to summarize something to help friends use the framework better. However, I do not like to cite the official list of the advantages and functions of translation here. So, I think I would simply comment on this framework purely from a personal point of view. It's not good to say, it's wrong to criticize me. ^_^
The product of ASP.net mvc--spiral progress
We have no way of knowing why Microsoft is launching ASP.net mvc, perhaps because of the fact that there is struts on the Java EE platform, perhaps because MVC is too popular, maybe Microsoft wants to make its own web app platform more perfect, but we can only guess. But it would be interesting to review the evolution of Microsoft's Web app platform.
asp--Microsoft's first contribution to web development may be the ASP, which has made dynamic web development less difficult. However, when many people are excited about using ASP to write one dynamic page after another, its shortcomings are gradually exposed: language is too simple, no object-oriented support, no good IDE support, dynamic scripting and static HTML mix together, making it extremely difficult to modify and maintain.
Web form--to be honest, even with the current perspective, Microsoft's Web Form programming model is really creative and practical. Microsoft pioneered the development of desktop applications into Web application development: Drag control, write event handling, running ... Everything is so beautiful, and the previous static code and back-end programs are completely isolated in two files, and users can use them. NET platform to perform back-end programming on any language. For programmers, using C # for programming is much more comfortable than using ASP. So the Web Form model can be said to be synonymous with. NET web App development, all based on. NET platform is familiar and accepted by web developers.
asp.net mvc--on the Web form, Microsoft unveiled ASP.net MVC. Strictly speaking, ASP.net mvc and Web form are not comparable, the Web form is a complete new model, from the top to the bottom is a set of things, and asp.net mvc is just for the Web form to wear an MVC-like jacket, it should be based on the web form is a programmatic way to extend the model. However, from the developer's perspective, the introduction of ASP.net mvc has really changed the way we develop, and many of the ways under the Web form are not advocated (you can still use it because ASP.net mvc is also web-based), for example, once-praised server-side controls are discarded again, Instead of using client-side controls again, the event-driven model is discarded, in turn using a similar traditional URL-jump-processing model. And in the way of data validation and the way the Web form is advocated has changed a lot.
So it seems like a reincarnation, it seems asp.net mvc brought us back to the ASP era: server-side model not to use, event-driven mechanism is not used, similar to the development of desktop app ... We seem to be back from the Web form to the traditional ASP era. But is that really the case? Of course not!
Just a little bit, you know, although asp.net mvc advocates us to abolish many things and habits under the Web form, but it is not to let us "return to the original", if we have to say is a reincarnation, it should also be said to be a spiral of reincarnation, is the ascent of reincarnation.
Remember that there is a very classical proposition in Marxist philosophy: for new things, the road is tortuous, the future is bright. Perhaps the development of the Web app model confirms this view. Perhaps, server-side controls, event-driven models these things are not suitable for web app at the outset, Microsoft has gone a lot of detours, now found the right direction. The pain of abandonment, we want to discard what once thought how accustomed and poured a lot of painstaking efforts of things, but, things are denied, the rest of a metamorphosis of the new things, is a better thing.
For example, we discard the server-side controls, event-driven models that have been in use for years ... But we've got a low coupling, a new web model that focuses on the decoupled, compliant MVC model. To dare to deny, to get new life. Microsoft is, and so are we.
The changes asp.net MVC brings
Now, let's look at what asp.net mvc is really denying us. And what can be gained.
1. Server-side form controls.
Because of the nature of asp.net mvc, server-side form controls are no longer advocated, such as our text boxes, no longer using asp:textbox, but with traditional input, or directly to Html.textbox generation. In short, many server-side controls have been repealed by us. Even the old friend of the GridView, who has brought us so much pleasure, is no longer advocated. However, it's not that you can't use any server-side controls, for example, in order to implement a master, our ContentPlaceHolder still has to be used.
2. Event-driven model.
Since server-side form controls are no longer advocated, the event-driven model is naturally not advocated, and the two are inherently complementary. In asp.net mvc, when a button is clicked, you should stop thinking that there should be a time process in the corresponding aspx.cs, and you should think that there is an action in one of the controller to handle the event. In fact, in asp.net mvc, it is advocated not to write any logical code in Aspx.cs. Should even when they don't exist.