Basics ASP.NET MVC – The Model-view-controller (MVC) is an architectural pattern framework developed by Microsoft which is an alternative to asp.net web forms for creating web application. The ASP.NET MVC frameworkis a lightweight and testable framework with existing asp.net features such as master pages, authentication, etc. and it will split application into three components Model, view and controller.
In Asp.net MVC tutorial covered complete topics from basic to advanced level those are
- Asp.Net MVC project structure
- Action Methods & URLS in MVC
- CRUD operations using Web API…and many more topics in Asp.net MVC.
- Creating Application in MVC
- Razor View Engine
- Roles Model, View, Controllers in Asp.Net MVC
Basics ASP.NET MVC
Why and When to Use MVC?
When we Need to develop application which should be lightweight and easy for testing and Maintenance and more Loose Coupling that time we can develop application in MVC.
In Asp.Net Webforms having various server control which generates large view state to maintain state which make page heavy . If application having low bandwidth can not access this Heavy page. Here using some Functionality of MVC it will increase performance of application.
Trending Now : TEN ASP.NET Article – You should not miss
ASP.NET MVC Architecture
ASP.NET MVC architecture separates an application into three main parts Model-View-Controller (MVC). MVC architecture provides good separation of concerns in general Loose coupling. Also read our previous tutorial about understanding the basics of Web Service in ASP.NET
MVC splits application in to three parts :
- Often model is used for retrieve data and store data from a database.
- The Model represent business logic and data.
- The View is responsible displaying data and transforming Model or Models to visual representation.
- Most often the views are created from the model data.
- Controller is a heart of the entire MVC architecture.
- The Controller take inputs from view and work with model and returns view.
- The Controller as name tell it controls the application logic and interacts between model and view.
Different Types of Project Templates in ASP.NET MVC :
While creating a new project in MVC by selecting “ASP.NET MVC 4 Web Application” we will get different project templates to select those are Empty template, Basic Template, Internet Application template, Intranet Application template, Mobile Application template and Web API templates.
Here the simple description about what are these templates in ASP.NET MVC and which template we need to select to create new project in asp.net mvc? by creating simple asp.net mvc web application.
Empty Template in MVC
The Empty template contains basic empty MVC folder structure with Global.asax file and App_Start folder at top and it will not contain Script folder and Content folder. This is just empty configuration from here you all need to create application.
Basic Template in MVC
The basic template contains Script folder with default script files and the Content folder will have themes and site.css style sheet inside it. Basic template comes under the MVC folder structure which is Model Folder, Controller Folder and View folder are empty but View folder has a Shared Folder in which it contains Layouts.cshtml and Error.cshtml
Internet Application Template in MVC
The Internet Application Template comes under the MVC folder structure which will contain default Home Controller and Account Controller with default View for both controller and Account Models which is required for registration. It also comes with Basic Login and registration Mechanism built in it. Internet Application template is completely ready application for development.
Intranet Application Template in MVC
The Intranet Application Template is little bit similar to Internet application Template. It contains default Home controller with related View in it. It also comes with built in windows based authentication mechanism. By using this Template we can develop the application for intranet-based systems.
Mobile Application Template in MVC
The Mobile Application Template is very similar to Internet application template which comes with default Home and Account controller with default View for both controllers. Mobile application templates also come with login and registration mechanism.
Web API Application Template in MVC
The Web API Application is another version of Internet application template which comes with default Home and Value controller with default View for Home controller and Value controller inherits from ApiController.It is used for creating HTTP based RESTful web services.