In an MVC application there are three main components
- Model
- View
- Controller
Model contains the application data and the business rules for our application.View is the representation of the Model to the end user ,usually through some GUI such as HTML.Controller is the component which handles the user’s request ,selects the Model and returns the view.
Once the view is returned by the Controller action method it has to be rendered and returned to the user.The View rendering is done by the ViewEngine
There are several ViewEngine’s we can use in an MVC application.Some of the important ones are
- Razor Convenient programming syntax and has minimal transition between HTML and code.It uses .cshtml extension
- ASPX Similar to the aspx programming model we are familiar while working with WebForms.It uses the WebForms extension .aspx
- Spark Emphasis on HTML in the View
- NHaml using the Haml markup language. It’s main points are it’s simplicity, terseness, performance and it outputs well formatted XML without using inline code.
- Brail Used with language Boo .Provides on demand compilation.This has been ported from MonoRail.
Brail,NHaml and Spark are part of the MVCContrib library which is a library that adds functionality to the ASP.NET MVC Framework