Friday 16 November 2012

MVC


Models. Model objects are the parts of the application that implement the logic for the application s data domain. Often, model objects retrieve and store model state in a database.
Views. Views are the components that display the application s user interface (UI). Typically, this UI is created from the model data.
Controllers. Controllers are the components that handle user interaction, work with the model, and ultimately select a view to render that displays UI. In an MVC application, the view only displays information; the controller handles and responds to user input and interaction. For example, the controller handles query-string values, and passes these values to the model, which in turn queries the database by using the values.
MVC stands for model-view-controller. MVC is a pattern for developing applications that are well architected and easy to maintain. MVC-based applications contain:

Controllers: Classes that handle incoming requests to the application, retrieve model data, and then specify view templates that return a response to the client.

Models: Classes that represent the data of the application and that use validation logic to enforce business rules for that data.

Views: Template files that your application uses to dynamically generate HTML responses.

ASP.NET MVC invokes different controller classes (and different action methods within them) depending on the incoming URL. The default mapping logic used by ASP.NET MVC uses a format like this to determine what code to invoke:
/[Controller]/[ActionName]/[Parameters]

No comments: