When I started developing a project in MVC3.0 with Razor (You will find 'What is Razor?' in next coming articles), I got so many doubts. I have searched so many sites and read so many articles to clarify and to get a better solution as per my requirements. Then I decided to write an article in MVC3.0 to clear those doubts. These set of articles explained in a manner that any body can understand what is mvc and how it can be implemented in real time projects.So let us start.
What is MVC?
Model–view–controller (MVC) is a software architecture,currently considered an architectural pattern used in software development.
What is Asp.Net MVC?
The Asp.Net MVC is one of the dotnet frameworks to develop web applications.
Why Asp.Net MVC?
- The main aim of developing MVC framework is to support pattern-based application development. In other words, the framework was designed to make it easier to implement software design principles and patterns when building web applications.
- More over it supports unit tests. Applications developed in MVC are highly testable.
- Because MVC applications are highly testable, it supports test driven development (TDD).
- Extensive support for ASP.NET routing, which is a powerful URL-mapping component that lets you build applications that have comprehensible and searchable URLs.
Advantages of MVC
- The MVC application can be divided into Model, View, Controller-so this makes it easier to manage.
- It does not use view state or server-based forms. This makes the MVC framework ideal for developers who want full control over the behavior of an application.
- It provides better support for test-driven development (TDD).
History of MVC
The MVC pattern was invented by Trygve Reenskaug. His first paper was published in 1978 on MVC. It was popularized for use on the web with the advent of Ruby on Rails in 2003.
Asp.Net MVC: In 2009, MVC 1.0 was released. In 2010, MVC 2.0 was released. In 2011, MVC 3.0 released.
The MVC Pattern
An MVC application can be divided into three parts:
Model: A model contains application logic. For example in stock management system, the model represents stocks, orders, purchases etc. i.e this consists all the application validation logic, business logic and data access logic.
View: In simple terms, it is a visual representation of model. A view contains HTML markup and view logic.
Controller: A controller process incoming requests, and performs operations in model, and renders a view or redirects to other view. A controller works as a mediator between a model and a view. In Asp.net MVC, controllers are c# classess and are derived from System.Web.Mvc.Controller class.
What is new in Asp.Net MVC 3.0?
Razor view engine is the major change in MVC3 version. Previous view engines are based on Asp.Net view engine, which depends on the Asp.Net < % and % > blocks. The razor view engine replaced these blocks with @ character.The new notation is quicker to write and faster to compile than the old view engine. It also has more flexible features and allows for better unit testing.
The other new features are:
- Extensible Scaffolding with MvcScaffold integration
- HTML 5 enabled project templates
- Support for Multiple View Engines
- Controller Improvements
- Model Validation Improvements
- Dependency Injection Improvements
- and some other New Features...
The examples under these articles are used with razor view engine. Because Microsoft team has made it clear that razor is the future of MVC.
In next article we will see how to begin a new MVC 3.0 Razor application. Comments/Suggestions are invited. Happy coding......!
Comments Post a Comment
Krishna Veer Singh 5/20/2012 (IST) / Reply
Upen 6/12/2012 (IST) / Reply
Good To Start.
Sudhakar 6/26/2012 (IST) / Reply
Easy to understand .Nice article
Siva Krishna 5/24/2013 (IST) / Reply
Nice for Beginners