ASP.NET MVC – Flashcards
Unlock all answers in this set
Unlock answersquestion
ASP.NET MVC
answer
The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the view, and the controller. ASP.NET MVC is a part of the ASP.NET Web application framework. It is one of the two different programming models you can use to create ASP.NET Web applications,the other being ASP.NET Web Forms. It is made up of interchangeable parts = Extensible. When a request comes in it is handled by a router engine deciding on controller and action finding appropriate view. The MVC pattern helps you create applications that separate the different aspects of the application (input logic, business logic, and UI logic), while providing a loose coupling between these elements. The pattern specifies where each kind of logic should be located in the application. The UI logic belongs in the view. Input logic belongs in the controller. Business logic belongs in the model.
question
MVC Application three attributes
answer
An MVC Application is designed and implemented using the following three attributes - Model, View, Controller.
question
Models
answer
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. For example, a Product object might retrieve information from a database, operate on it, and then write updated information back to a Products table in SQL Server. Model == Application logic such as business logic, validation logic, data access.
question
Views
answer
Views are the components that display the application's user interface (UI). Typically, this UI is created from the model data. An example would be an edit view of a Products table that displays text boxes, drop-down lists, and check boxes based on the current state of a Products object. View == HTML page, scripts, css
question
Controllers
answer
Controllers are the components that handle user interaction, work with the model, and ultimately select a view to render that displays UI. Responsible for controlling a users interaction with the application. Takes the browser request and then it contains logic on how to respond to that browsers request. 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. Controller == application flow control logic.
question
MVC Features - Areas
answer
Allows you to organize your application in multiple logical pieces to improve the team collaboration and development process. (input logic, business logic, and UI logic)
question
MVC Features - UI Helpers
answer
You can ensure more maintainability as you modify your applications using strongly-typed helpers such as Html. TexBoxFor. The new templated helpers let you easily associate HTML elements for edit display with data types improving productivity.
question
MVC Features - Asynchronous controllers
answer
Allows you to improve the throughput of your Web applications without blocking threads on expensive, long running resource calls.
question
MVC Features -Server-side validation:
answer
Allows you to use the declarative data annotations to define validation rules on your model.
question
MVC Features - Client-side validation
answer
Automatically generates client-side validators based upon the annotations on your model.