Let’s now discuss about what ASP.NET MVC Framework installer does for us. We have the following changes happens with the installation
- Registers System.Web.Mvc.dll in Global Assembly Cache (GAC) and a copy onto the \Program Files\Microsoft ASP.NET\ASP.NET MVC 1.0\Assemblies folder
- Installs various ASP.NET MVC templates integrated with Visual Studio
- Registers .mvc file extension with IIS
Now let’s discuss about the default MVC project structure. When we create a new ASP.NET MVC web application project, Visual studio itself provides with initial files and folder structure. It’s really important to learn about each of these items. So let’s discuss about the same as follows in brief
- /App_Data : Stores file based database and other data files. IIS will not server its contents to public.
- /bin : Contains all the required .net assemblies for the project.
- /Content : Here we can place static files like .css which can be served to public
- /Controllers : Project specific controller classes (derived from Controller or implements IController)
- /Models : We place all domain model classes
- /Scripts : We can store all static script files inside this folder
- /Views : Holds .aspx or .ascx files
- /Views/Shared : View templates which are not associated with any controllers
- /Views/Web.config : This is not application’s main config file, instead it directs not to serve any .aspx files directly.
- /Default.aspx : This is not relevant for ASP.NET MVC application but it is required for IIS6 compatibility.
- /Global.asax : Defines global ASP.NET application object, registers your routing configuration etc. It serves the same purpose as ASP.NET Web forms.
- /Web.config : Defines application configuration
Apart from the above common files and folders, we have certain optional files and folders as follows which serves different purposes
- /App_GlobalResources/App_LocalResources : Stores resource files required for localization
- /App_Browsers : Contains . browser xml file
- /App_Themes : Contains themes and skin file
- Controller classes name should end with “Controller”
- View templates should go into /Views folder only
- The default view for an action method should be named after the action method.
- /Views/Shared can be used to share views across multiple controllers
So here we conclude this post just briefing about the initial files and folder structure of ASP.NET MVC project. Please note that this is not a mandatory structure for any real project scenario.
No comments:
Post a Comment