Creating First MVC5 Application

Creating First MVC5 Application (Beta)

Here we are going to start mvc5 application descriptions. In previous tutorial we explained about the mvc. If you are new to this so I recommended that, please go through first article MVC Introduction. Here we will create a mvc5 application and understand the application files and directories that default generated by visual studio for internet application template. Now follow the below instructions to create a mvc5 application using visual studio 2015. How to create mvc5 application

Open VS => File => New => Project => Web (from left side) => ASP.NET Web Application => Ok => Select MVC => Ok

Once application is created successfully then application will look like below:


demoimage

Now I am going to start description of all the folders and files that generated by visual studio in mvc internet application template:

Application's Folders
Folder Description
App_Data App_Data folder is the storage location of file based data like .mdf, .xml, .csv, .txt etc. You can also manipulate the data that stored in .xml, .txt or .access file. It can't be accessed or downloaded by web users. This is the best place to store small database in .xml, .csv or .txt format.
App_Start App_Start folder contains all the class files at registered in global.asax at the time of statup the application. It contains BundleConfig.cs, FilterConfig.cs, IdentityConfig.cs, RouteConfig.cs and Startup.Auth.cs files
Controllers The controller folder contains all the controllers. Controller handle user request and response, and retreive the model data, response back the result and renderer view.
Views The view folder is contains all the view (UI) pages. Views are the parts of the application that responsible for representing UI. Typically, it is created from model data. The user always accesses only the view.
Models The models folder contains all the model class. Models are the part of the application that responsible for data logic i.e. data access from the database or any other source. Model use to represent the application data on view. Its sends user inputs from view to controller. It also provides validation logics. It always communicates between controller and view.
Content Content folder contains all the css style files.
Scripts Scripts folder contains all the javascripts, jquery and script relates files.
Fonts The fonts folder contains font files that default generated by visual studio.
Application's Files
File Description
BundleConfig.cs Used for providing bundling concept for loading styles and script files.
RouteConfig.cs Used for implementing routing concept in mvc.
packages.config package.config file is used by nuget for tracking the installed package and their versions. Whenever you installed or update any plugins or tool from nuget package manager, then this file will update that assembly information and save in it.
startup.cs

The startup class is the entry point of the application. Used for setting up the configuration and services that will used by application. startup class is used to configure a request pipeline that handled all requests made to the application.

startup.cs file is introduce with ASP.NET 5 OWIN(Open Web Interface for .NET) application which allow web application to be decoupled from web and services. startup class must define a configure method which is called when application is started.

Global.asax The global.asax file the optional file that resides in the root level of application. It contains application level events. At application initialization time is, it will compiled by HttpApplication object.
Web.config Web.config file contains all application level configuration settings like connection strings, app constants, authentication, authorization and many more information about the application. This is basically used for web application only that contains information in xml format.