An Overview of ASP.NET MVC3

ASP.NET MVC3 is a framework which is used to build scalable, standards-based web application using well-established design patterns and power of ASP.NET and .NET Framework.

MVC stands for Model (which is usually C# class or VB.NET class which represents models for your application), View (It’s usually ASPX page which is viewed by user) and Controller (which control request and response of users). While developing application in MVC you need to remember responsibility of process of separation of concern.

One of the major challenges which are faced by normal web forms is testability of business logic. Unit test of code behind logic is very complex. ASP.NET MVC address the plain point associated with the traditional web form applications. You can also use nunit or xunit or moc testing tools with ASP.NET MVC.

ASP.NET MVC3 comes with new view engine called Razor view engine. This engine provides a concise way in which to mix code and markup within the same file.  As an example, the following code snippet shows a simple page using the older ASPX templating engine that constructs a list of product names:

<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<Product[]>" %>


<% foreach(var product in Model) { %>

<li><%: product.Name %></li>

<% } %>


This is quite verbose. The Page declaration at the top and the code nuggets (<% and %>) that are used to switch between code and markup add a lot of additional characters to the page markup. By contrast, Razor provides a much cleaner way to provide the same result:

@model Product[]


@foreach(var product in Model) {




ASP.NET MVC 3 also comes with the NuGet Package Manager. NuGet simplifies the management of dependencies by providing a facility that can be used to install components, libraries and other utilities directly into your project without needing to manually visit a website to download the library that you're looking for. 

ASP.NET MVC 3 exposes additional extensibility points that you can use to hook in your own components to replace various parts of the framework. MVC 3 introduces the concept of a dependency resolver that can be used to instantiate objects and provide them back to the framework. This approach can be used to integrate with various dependency inversion containers in order to minimize the number of times you have to manually instantiate objects. 

MVC 2 introduced support for using Data Annotation attributes for performing validation for model objects. These attributes have been significantly improved with .NET 4, and MVC 3 takes full advantage of this. In addition, support for client-side validation has been greatly improved.

Leave Comment