Introduction to ASP.Net MVC

This is my first post for ASP.Net MVC. As mentioned before we will be discussing only about ASP.Net MVC out here. The post only describes about the basics of ASP.Net MVC. Before reading this post, you don’t need to know much more about ASP.Net MVC, this post will certainly help you to know more about ASP.Net MVC.

Now there is a new boom in the Microsoft Technologies about ASP.Net MVC, since its launch it is continuously evolving through many phases of improvement. Currently there are following variant framework versions for ASP.Net MVC

  1. ASP.Net MVC CTP – Dec 2007
  2. ASP.Net MVC 1.0 – Mar 2009
  3. ASP.Net MVC 2.0 – Mar 2010
  4. ASP.Net MVC 3.0 – Jan 2011
  5. ASP.Net MVC 4.0 – Preview Available

As you can see from the above, at what pace ASP.Net is evolving. There are 3 stable versions still it launched in Mar 2009.

So, the question arise what is MVC in ASP.Net MVC?

The answer is MVC stands for Model-View-Controller. ASP.Net MVC is one of the Microsoft’s Web Application Development Framework just like ASP.Net MVC Web Forms are. ASP.Net MVC is architecture to develop ASP.Net Web Applications in a somewhat different manner than the traditional ASP.Net Web Forms development. ASP.Net MVC implements the well know MVC design patterns which is one of the most old & popular designing pattern across the developers for so many years.  Let’s describe what MVC stands for in ASP.Net MVC.

MVC bindings

  1. Models – A model is a C#/VB.Net class. This class may implement some data access logic, some business logic or just an representation of any business entity, such as Person, a customer, a book or even a database table also. This class can be accessed by Controllers & Views in order to pass data to & from the Controller or View.
  2. View – Views are the components that display the Applications User Interface (UI). A view is an ASPX or ASCX (User Control) which contains some HTML mark up. A view also can contain some inline C#/VB.Net code to develop dynamic pages. All page specific HTML is written in View, along with the formatting part. A request to view the View can only be made from Controller’s Action Methods.
  3. Controllers – A controller is again a C#/VB.Net class which always inherits Controller class in System.Web.MVC.Controller class. This class maintains the flow of the application’s logic. In other words we can say that Controller is the heart of the ASP.Net MVC applications. It acts as a mediator between Models & Views, creates a medium for communication between the two. Ideally it passes data from the Models to Views & Vice versa. Each controller contains some Action Methods which are responsible to render Views when browser requests for a View.

By default, MVC pattern allows us to create applications that separate different aspects of the applications such as Business Logic, Input Logic and User Interface. The UI logic belongs to the Views, input logic is managed by Controllers & the Business Logic is handled by Models. This clear separation allows us to manage the complexity when we build the applications.

In the next post we will discuss about advantages of ASP.Net MVC over the ASP.Net Web Forms.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s