Introduction to MVC architecture
Firstly, MVC architecture stands for Model, View and Controller. Moreover, Let us learn in brief about this architecture.
Model : Firstly, Model will represent the shape of the data. Secondly, C# class will describe a model. Thirdly, Objects of model store data that comes from the database. Hence, model represents the data.
View: View in MVC architecture depicts the user interface. It shows model data to the user. User can update or modify the data as per requirement. Moreover, view represents HTML, CSS and razor syntax that makes it easy to communicate. Hence, view is the user interface.
Controller: Controller handles the requests of user. When user sends HTTP request, it is handled by the controller. Controller will return appropriate view as a response. Thus, controller is the request handler.
Certainly, when user enters URL, browser goes to the web server and controller handles the request and returns appropriate view.
MVC architecture folder structure
Visual Studio for MVC creates a folder structure which contains following by default folders:
- App_Data
- App_Start
- Content
- Controllers
- fonts
- Models
- Views
- Scripts
- Packages.config
- Global.asax
Firstly, App_Data folder in MVC contains the data files for application like LocalDB, .mdf files and XML files.
Secondly, App_Start folder will contain class files which are typically config files. This includes the following:
- AuthConfig.cs
- FilterConfig.cs
- BundleConfig.cs
- RouteConfig.cs
Thirdly, Content folder has static files like CSS files, icon files and image files. MVC version 5 had bootstrap.css, bootstrap.min.css and site.css by default.
Moreover, Scripts folder contains VBScript or JavaSacript files.
Packages.config file tracks what packages and versions are to be installed in application. In addition, Global.asax file will allow to write code that runs in response to application level events like Application_BeginRequest, application_error, application-start, seesion_start and session_end.
ASP.Net MVC Features
ASP.Net MVC provides the following features:
- It can develop complex but lightweight applications.
- Provides an extensible framework which is customize.
- Utilizes component based design by dividing into Model, View and Controller.
- Enhances test driven development.
- Supports authentication, Data Binding, Authorization and Routing.
Conclusion
In conclusion, we have learnt that Firstly, MVC architecture stands for Model, View and Controller. Model will represent the shape of the data. View in MVC architecture depicts the user interface. Controller handles the requests of user.
Visual Studio for MVC creates a folder structure which contains following by default folders: App_Data, App_Start, Content, Model, View, Controller, fonts, Scripts, Packages.config and Global.asax file.
Moreover, MVC architecture can develop complex but lightweight applications. It provides an extensible framework which is customize. Also, it supports authentication, Data Binding, Authorization and Routing.