Sunday, 26 May 2013

MVC Folders

A Closer look at the default files & folders


 



ou can see that in the Solution Explorer the Visual Studio has created some files and folders

Application Information

Properties                  :   
References                  :   

Application Folders 


App_Data Folder             :   Used for storing application data

Content Folder              :   Used for storing static files like 
                                stylesheets icons & images 

Scripts Folder              :   Put the javascript files in here. 
                                By default it contains mvc , ajax & 
                                jquery files.
                                 
Models Folder               :   Contains a Folder for every Controller, 
                                its used to store the view (.cshtml) files 

Views Folder                :   Contains Model Class which represent 
                                the application models.Model Classes 
                                are used for data manipulation 

Controllers Folder          :   Contains Controller Class which is 
                                responsible for handling user input 
                                and responses

Configuration Files 


Global.asax                 :   Its an optional file, This is where u 
                                write logic at the application leavel 
                                or define objects with session or application 
                                wide scope . Example of practical use 
                                Eg. "Error Handling" . 
                                You can define event handlers in the 
                                application wide or session wide scope.

Packages.confuguration      :   

Web.config                  :   

Microsoft has released the official ASP.NET MVC package this month. Those used to work with ASP.NET applications will notice a lot of new and cool features that may improve your web applications.

The MVC Design Pattern

The MVC (Model View Controller) pattern is not new. Its first version came out almost 30 years ago and is available currently in several frameworks.
User interface, business rules and flow orchestration in most part are so tied that become hard to reuse code and the level of dependency is high. That is the problem MVC expects to solve: the separation of concerns and how to decouple the user interface and the business layer. The three pieces that compound the pattern are:

Model: The Model is the core piece of the MVC and is responsible for data access, business validations and to expose the objects that will be consumed by the views. The model does not know anything about the View though.

View: The View is responsible for either displaying or accessing the information exposed by the model to build the user interface;

Controller: The Controller is responsible for handling user interactions and notifying the model that an action is requested.

ASP.NET MVC

Some characteristics of the new ASP.NET MVC:
  • Due to its separation of concerns it makes it easier to implement and manage complex business logic;
  • The view state is not available anymore avoiding some “needless abuses” of storage and making the application lightweight;
  • Server controls are not available anymore. At first sight it seems harder to work with but the MVC framework provides a good support to gather the form values;
  • It gives developers and web designers enough control over both layouts and features;
  • Apply unit tests on the controller component is pretty straightforward;
  • The basic project template provides support for security (login and registration);
  • The ability to scaffold properties from a model and generate create, update, details and list Views.
Post a Comment