Lessons in this course (10)

1. MVC 5 folder structure explained

Basic★ Must knowLesson 1 of 10
text
ShopMvc/                                  (ASP.NET Web Application, .NET Framework 4.8, MVC template)
├── App_Data/                             local database files, not web-accessible
├── App_Start/                            startup configuration called from Global.asax
│   ├── RouteConfig.cs                    conventional routes ("{controller}/{action}/{id}")
│   ├── FilterConfig.cs                   global filters (HandleErrorAttribute, AuthorizeAttribute)
│   ├── BundleConfig.cs                   CSS/JS bundles and minification
│   ├── IdentityConfig.cs, Startup.Auth.cs  ASP.NET Identity + OWIN cookie authentication
│   └── UnityConfig.cs                    dependency injection container (if added)
├── Areas/                                sub-applications, each with its own Controllers/Models/Views
│   └── Admin/  (AdminAreaRegistration.cs, Controllers/, Views/)
├── Content/                              CSS (bootstrap.css, Site.css), images
├── Controllers/                          HomeController.cs, ProductsController.cs, AccountController.cs
├── fonts/                                icon fonts
├── Models/                               entities, view models, DbContext (often moved to separate projects)
├── Scripts/                              jQuery, jquery.validate, bootstrap.js, your JS
├── Views/
│   ├── Shared/                           _Layout.cshtml, Error.cshtml, partials (_LoginPartial.cshtml), EditorTemplates/, DisplayTemplates/
│   ├── Home/                             Index.cshtml, About.cshtml (folder name = controller name)
│   ├── Products/                         Index.cshtml, Details.cshtml, Create.cshtml, Edit.cshtml
│   ├── _ViewStart.cshtml                 sets Layout for all views
│   └── web.config                        Razor config (namespaces for views) + blocks direct access to .cshtml
├── Global.asax / Global.asax.cs          Application_Start: AreaRegistration, FilterConfig, RouteConfig, BundleConfig
├── Startup.cs                            OWIN startup (Identity, SignalR)
├── packages.config                       NuGet packages
├── Web.config (+ Web.Debug/Release.config transforms)
└── ShopMvc.csproj

Conventions: a controller class ends with Controller and lives in Controllers/; its views are in Views/<ControllerName>/<ActionName>.cshtml; shared views in Views/Shared. Layered solutions usually add Shop.Core (domain), Shop.Data (EF/Dapper), Shop.Services projects referenced by the web project.