Wednesday, February 8, 2012

Getting Started with ASP.NET MVC 3

As all of you know, ASP.NET is one of the most powerful and secured technologies for web related development. It has a higher penetration as well as an increasing demand towards it. Higher security capabilities, ease of development and maintenance, flexibility and scalability are some of the reasons for lot of reputed companies in the world to selecting ASP.NET for their solutions. Model-View-Controller design pattern is one of the highly used design patterns in today’s world. The simplest basic behind this is dividing the application in to three components named Model,View and Controller. ASP.NET MVC Framework is a framework that supports the development based on MVC design pattern with a lot more enhanced set of features. It provides the developer the capabilities of developing a web application with a less amount of coding that needed to be done manually.

These three elements of MVC can be summarized like this;
Model – Model objects are the parts of the application that implement the logic for the application’s data domain.
View – Views are the components that display the application’s user interface (UI).
Controller – Controllers are the components that handle user interaction, work with the model, and select a view to render the user interface. In ASP.NET MVC 3, a controller has the suffix “Controller” in each file name. For example, the controller which manages the Accounts will be AccountController.
If you have MVC installed in Visual Studio 2010, you will be able to Select a MVC 3 Application under the Web Template. Once you give a name and the location to be settled in the project another windows will pop-up asking the sort of application need to be created. They are Empty, Internet and Intranet.
Intranet Application is an application that would work with Windows Authentication. Once you are logged into your Windows System under a particular domain, you will not be asked to log into the system again. ASP.NET uses the credentials that you provided to log into Windows as the credentials needed for the system.
Internet Application is like most of the applications we see in today’s contest that we do need to use a Forms-based Authentication mechanism to log into the system. The application has already set up the UI and the required model for the application to facilitate the Forms-based Authentication.
Empty Application is as it’s means will not be available with no special authentication mechanism defined in it. The developer will have to decide and write the code behind to facilitate the authentication.

For the moment, I create an Empty Application. Once you select one of the projects categories and get it done, the Solution Explorer will display a particular folder structure. The ASP.NET MVC framework has defined and assigned particular set of content to be made available inside each.
The Content Folder holds the static resources that will be used to create the application such like Style-sheets, Images and etc… Controllers folder keeps all the Controller components of MVC that will be used through out the application. Models folder stores the model items such as Data Access Objects. Simply, the Model components of MVC. Javascripts including JQuerry libraries and other sorts of scripts used throughout the application are stored in the Scripts folder. Views folder stores the View components of MVC, in ASP.NET MVC, there is another subfolder inside the Views folder for each and every controller in its name. For example, theAccountController will be having a folder named Account inside the Views folder. All the views that are accessed through AccountController are located inside the Accounts folder. Shared sub folder inside the Views folder contains the shared resources.
Lets discuss about each element of the MVC in depth in next articles. 

No comments:

Post a Comment