Day by day ASP.NET MVC becomes the popular framework among the developers because of clean code and folder structure.In this first article of ASP.NET MVC articles series we will understand folder structure of ASP.NET MVC application.
Many new developer and students are struggling to learn ASP.NET MVC in quick time and in MVC lots of technologies are used like javascript , jQuery , AngularJs , Typescript ,Dapper ,Entity framework and much more because of this developers and students get confused how to start learning ? , by considering above problem and help students and developers who wants to learn quick about MVC, I have decided to start series of articles on ASP.NET MVC .
avoid having to configure and specify things that can be inferred based on convention by adding code through Scaffolding .
For instance, MVC uses a convention-based directory-naming structure when resolving View templates and this convention allows you to omit the location path when referencing views from within a Controller class.
MVC is designed around some sensible convention-based defaults that can be overridden as needed.
This concept is commonly referred to as "convention over configuration" which popular concepts of Ruby on Rails programming language.
The convention over configuration concept implemented in ASP.NET MVC with the help of following main directories
Step 1 : Create MVC Application To Create Folder structure
The preceding project solution explorer you have seen different folders and files . The preceding folder structure may be different according your MVC project template , So let us learn about major folders in brief as in the following:Many new developer and students are struggling to learn ASP.NET MVC in quick time and in MVC lots of technologies are used like javascript , jQuery , AngularJs , Typescript ,Dapper ,Entity framework and much more because of this developers and students get confused how to start learning ? , by considering above problem and help students and developers who wants to learn quick about MVC, I have decided to start series of articles on ASP.NET MVC .
MVC And Convention standard
ASP.NET MVC applications, by default, depends heavily on conventions. This allows developers toavoid having to configure and specify things that can be inferred based on convention by adding code through Scaffolding .
For instance, MVC uses a convention-based directory-naming structure when resolving View templates and this convention allows you to omit the location path when referencing views from within a Controller class.
MVC is designed around some sensible convention-based defaults that can be overridden as needed.
This concept is commonly referred to as "convention over configuration" which popular concepts of Ruby on Rails programming language.
The convention over configuration concept implemented in ASP.NET MVC with the help of following main directories
- Controllers
- Models
- Views
- Each controller name ends with suffix controller.
- The single view directory can be used for entire application.
- By default all directories (folder) created with name of controller name.
Step 1 : Create MVC Application To Create Folder structure
- "Start", then "All Programs" and select "Microsoft Visual Studio 2015".
- "File", then "New" and click "Project..." then select "ASP.NET Web Application Template", then provide the Project a name as you wish and click on OK .
- App_Data
- App_Start
- Content
- Controllers
- Models
- views
- Script
- App_Data
- Controller
This folder contains the controller and their methods. The controller is responsible for processing the user request and return output.
- Models
You can rename the folder Model and you can give any name as you wish ,its not mandatory that the folder name should be Models however model name is only for better naming conventions . also Model can be created in separate class library project .
- View
This folder contains the UI pages including shared page, .CSHTMl, .VBHTML, HTML,aspx pages that show the output to the end user.
- Content
This folder is used to store files related to design and UI such as CSS files ,images which is require for UI..
- Script
From preceding example we have learned how the folder structure architectures and use of each folder.
Note:
Its not mandatory that you should use above folder structure and naming conventions, You can rename it and follow different folder structure as you wish.
To learn more about MVC basic in terms of to understand preceding folder structure practically please refer following videos series.
MVC Basic Videos.
- How to Create MVC Application Step by Step in Visual Studio 2015
- CRUD Operations In ASP.NET MVC 5 Using Entity Framework
- Return Json Result in ASP.NET MVC 5
I hope this article is useful for all readers, if you have a suggestion then please contact me.To learn ASP.NET MVC step by step please refer following articles
For more MVC article ,please refer www.compilemode.com , MVC section using following link.
- ActionResult in ASP.NET MVC
- Creating an ASP.NET MVC Application
- CRUD Operations In ASP.NET MVC 5 Using ADO.NET
- Convert DataTable To Generic List In ASP.NET MVC .
- How To Pass Stored Procedure Using Dapper.NET In MVC
- Show Confirm Alert Box on ActionLink Click In ASP.NET MVC.
- Convert DataTable To Generic List Using LINQ In ASP.NET MVC.
- How to Change ActionLink Text Color In ASP.NET MVC .
- How to Call Another Controller View Using ActionLink In ASP.NET MVC .
- Convert DataTable To Generic List Using AsEnumerable In ASP.NET MVC .
- How To Pass Generic List Using Dapper In MVC
Post a Comment