2010년 9월 10일 금요일

Mvc Music Store(2) - Create Project

File / New Project

Run Visual Studio. (In my case, I have Visual Studio 2008). Please select File>New>Project on then mainmenu.

Then we will select "ASP.NET MVC2 Empty Web Application" template. Please give the 
Name: MvcMusicStore
Location: C:\Project
Solution Name: MvcMusicStore


Press Add button and then after a while a new proejct will be created. Please have a look at the folders which are included in our application in the Solution Explorer on the right side.

ASP.NET MVC makes use of some basic conventions for folder names. I think that this is important knowledge to understand ASP.NET MVC.

 /Controllers
   Controllers are a kind of gateway because every request from Web Browser pass through Controllers. They respond to input from the browser, decide what to do with it, and return to the user. I can feel that this controllers act like a post office. Post office deliver their letters according to their address through post men. Therefore, our starting point in this project will be from Controllers.
/Views
  Views take charge of displaying content on the Web Browser. So Views include HTML and CSS codes. Views hold our UI templates.
/Content
  This folder holds some resources like images, CSS files, and any other static content.
/Scripts
  What is the scripts in Web Applications? It means JavaScript, so this folder contains JavaScript files.
/App_Data
  This folder holds data files which can be read and updated by the application.

Let's open Window Explorer and have a look at the real folder structure.

"MvcMusicStore" folder on the left has created under the Solution folder "MvcMusicStore" because we gave the same names with solution name and project name.


One interesting thing is ASP.NET MVC is using jQuery as a basic JavaScript framework. This indicates that ASP.NET MVC will offers all powerful functions jQuery does.

These folders are included even in an Empty ASP.NET MVC application because the framework makes some assumptions based on folder in naming conventions. For instance, controllers look for views in the Views folder by default, so sticking with the basic conventions not only makes it easier for other developers to understand your project, it simplifies your code.

댓글 없음:

댓글 쓰기