I want to share some ideas about MVC4. This is useful for all kind of beginners who wanted to get started with MVC4. I learned all these things & really it’s a nice experienced for me. It is useful in future also. I just explain you following things about MVC4 in short.
- Basic Concepts
- How MVC works?
- Features & so on…….
ASP.NET MVC 4 (Model View Controller) is open source. It helps to reduce the complexity of the web application by dividing an application into three layers, Model, View and Controller.
Steps for creating MVC4 application in visual studio 2010/1012:
- First Select New Project from the Start page or you can use the menu and select File -> New Project.
- You can create applications using C# or VB as the programming language. Select C# and then select ASP.NET MVC 4 Web Application.
- Give a name to your project and then click OK.
- Select Internet Application & Leave Razor as the default view engine & click OK.
- View Engines are used for designing. It is responsible for rendering the HTML from your views to the browser. The types of four view engines are as fallows:
- ASPX (C#)
- Razor (CSHTML)
- Name of different return types of controller action method are:
- View Result
- The three segments of default route, that is present in ASP.NET MVC application are:
- Controller Name
- Action Method Name
- Parameter that is passed through action method
- MVC File Structure & File Naming Standards:
It uses a standard directory structure and file naming standards. There must be 3 directories each for model, view and Controller. Expect from these 3 directories, there must have a Global.asax file in root folder, and a web.config.
- Controller CS files
- Model CS files
- View aspx/ascx files
The pictorial representation of MVC framework is as follows:
An MVC application consists of Model, View and Controller.
- Model: It consists of the method definations, data access logic and Business Objects.
- View: A view is used for user interface.
- Controller: It call views. It consists of the main application flow logic.
The main advantages of ASP.net MVC are:
- Enables the full control over the rendered HTML.
- Provides clean separation of concerns.
- Enables Test Driven Development.
- No ViewState and PostBack events
New Features in MVC4:
- ASP.NET Web API
-It consists following features:
- Modern HTTP programming model
- Full support for routes
- Model binding and validation
- Improved testability
- Code-based configuration
- Create custom help and test pages
- Link generation
- Refreshed and modernized default project templates
- New mobile project template
- Many new features to support mobile apps
- Enhanced support for asynchronous methods
If you know more about this then please share.