MVC Flashcards
What is a tier 1 architecture?
All of the layers (business, data, presentation, etc…) are on the same machine
What is a tier 2 architecture?
The presentation layer or interface runs on a client, and a data layer or data structure gets stored on a server.
What is MVC?
MVC is an architectural pattern that separates an application into three main logical components: the model, the view, and the controller. Each of these components are built to handle specific development aspects of an application.
Describe the model portion of the MVC.
The Model component corresponds to all the data-related logic that the user works with. This can represent either the data that is being transferred between the View and Controller components or any other business logic-related data.
Describe the view portion of the MVC.
The View component is used for all the UI logic of the application.
Describe the controller portion of the MVC.
Controllers act as an interface between Model and View components to process all the business logic and incoming requests, manipulate data using the Model component and interact with the Views to render the final output.
Describe the ActionResult class.
Represents the result of an action method. The ActionResult class is the base class for all action results. You decide which type of action result to return based on the task that the action method is performing.
Describe the ViewResult class.
Represents a class that is used to render a view.
Describe the JsonResult class.
An action result which formats the given object as JSON.
Describe the ContentResult class.
Represents a user-defined content type that is the result of an action method.
Describe the FileResult class.
Represents an ActionResult that when executed will write a file as the response.
Describe an action method.
Action methods are like normal methods with the following restrictions:
- Action methods must be public
- Action methods cannot be overloaded
- Action method cannot be a static method.
Describe enable code first migrations.
The migrations feature enables you to change the data model and deploy changes to production by updating the database schema without having to drop and re-create the database.
Describe what is unique about the code first migrations.
In production, when the application is running, it is usually storing data that you want to keep and you don’t want to lose everything each time you make a change such as adding a new column. Code First Migrations feature solves this problem by enabling Code First to update the database schema instead of dropping and recreating the database.
Describe the HtmlHelper class.
It supports the rendering of HTML controls in a view.
Describe model binding.
Model binding in ASP.NET Core MVC maps data from HTTP request to action method parameters. The parameters may be simple types such as strings, integers, or floats, or they may be complex types.
Describe tempdata.
Tempdata is a dictionary object used to share data between controller actions. Tempdata stays for subsequent HTTP request as opposed to other options like ViewBag and ViewData that stay only for the current request.
The ASP.NET MVC framework maps URLs to classes that are referred to as __________.
controllers
Describe what a controller does.
Controllers process incoming requests, handle user input and interactions, and execute appropriate application logic.
Describe what a controller class does.
A controller class typically calls a separate view component to generate the HTML markup for the request.
The controller defines ______ _______.
action methods
Describe the model portion of the MVC design pattern.
The model directly manages the data, logic and rules of the application. It expresses the applications behavior in terms of the problem domain.
Describe the view portion of the MVC design pattern.
A view can be any output representation of information, such as a chart or diagram. Multiple views of the same information are possible.