开发者

Confused with ASP.Net MVC

开发者 https://www.devze.com 2023-01-25 17:38 出处:网络
I\'m trying to figure out the difference between ASP.NET and ASP.NET MVC. Mode-View-Controller called a MVC is a development model/pattern/programming model, right? It is just a way the code can be wr

I'm trying to figure out the difference between ASP.NET and ASP.NET MVC. Mode-View-Controller called a MVC is a development model/pattern/programming model, right? It is just a way the code can be written by a developer 开发者_StackOverflowto have full control over the code. If that is the case what are MVC 1, MVC 2 etc. released by Microsoft and the 'special framework' for MVC pattern?


The comparison you make is slightly awkward because ASP.NET is a platform, whereas ASP.NET MVC is a customization/enhancement of that platform to facilitate programming against established MVC paradigms and best practices.

That being said, ASP.NET WebForms takes a particular approach to building web applications: single-form pages and simulating 'state' via the (often dreaded) ViewState object. Meanwhile, ASP.NET MVC focuses on separation of concerns (presentation, business, and persistence logic) as well as 'out of the box' support for things like routing (clean URLs - no ugly .aspx) and model binding.

Each has its own benefits - ASP.NET Classic WebForms provides a plethora of available user controls to get up and running quickly. It is also arguably easier to pick up if you're coming from a Windows Forms or WPF background (since the code-behind and events appear very similar).

The MVC releases (1, 2, and 3) provide project templates, some starter code, and other goodies like support for other rendering engines (i.e. Razor). You will have to get your hands more dirty with JavaScript using MVC, but you have complete control over the generated markup, and the freedom to extend the framework however you see fit.


The basic idea behind MVC (not a new pattern, BTW) is separation of concerns. The main difference between ASP.NET and ASP.NET MVC is that ASP.NET works on a "web forms" model in which each page is a "control" which has child controls, which in turn have child controls - you get it, it's a hierarchy of controls. However, ASP.NET MVC has no controls! A totally radically different world if you've lived your development career within the context of controls, viewstate, and postbacks (like myself).

Just do some Google searching - you'll find plenty of information on the topic, and lots of debate about which is better to use. Go through an MVC tutorial. It's a totally different, often cleaner way of doing web development if you are used to ASP.NET web forms.


ASP.NET MVC is a subset of ASP.NET

Microsoft has developed a Visual Studio plugin for MVC that will help you implement an MVC pattern easily. The different versions you see are the versions of the plugins.


MVC pattern is too abstract (primitive) to be of any use in the real world applications out of the box. That's why ASP.NET MVC framework looks "low-level" comparing to ASP.NET web forms. But what is good about it is that its new model of delivering releases - much faster than typical 3-5 years cycle we used to Microsoft's products. And they started listen to the community. So lets hope we can get robust framework somewhere in MVC 5 release.

0

精彩评论

暂无评论...
验证码 换一张
取 消