dot Net Core Study Guide

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What is the MVC Request Lifecycle?

- Incoming HTTP Request - Routing - Routed to a pre-defined match - Controller Initialization - Controller is created and initialized - Action Execution - Method is found and invoked from controller (data is mapped via model-binding) - Result Execution - Results are prepared to send back to client - Outgoing HTTP Response

What are the benefits of MVC architecture?

- Provides separation of concerns - Limits interdependencies between different components - Promotes loose coupling - Increases maintainability and testability - Greater system stability - Extensible and customizable framework

What is the Controller class?

-A base class for an MVC controller with view support. -Inheritance: Object>ControllerBase>Controller -Implements: IActionFilter, IAsyncActionFilter, IFilterMetadata, IDisposable

What is the ControllerBase class?

-A base class for an MVC controller without view support. -Inheritance: Object>ControllerBase -Attributes: ControllerAttribute

What is attribute-based routing?

-Attribute routing enables you to specify routing information by decorating your controllers and actions with attributes that define your application's routes. This means that your route definitions are placed next to the controller and action with which they're associated. -Uses a set of attributes to map actions directly to route templates. -The controller and action names play no part in which action is matched, unless token replacement is used. -Used with REST APIs.

What is convention-based routing?

-Convention-based routing enables you to globally define the URL formats that your application accepts and how each of those formats maps to a specific action method on given controller. When an incoming request is received, the routing engine parses the URL and matches it to one of the defined URL formats, and then calls the associated controller's action method. -Is based on the controller and action names only. -Isn't based on namespaces, source file locations, or method parameters. -Typically used with controllers and views.

What is the ApiControllerAttribute class?

-Indicates that a type and all derived types are used to serve HTTP API responses. -Controllers decorated with this attribute are configured with features and behavior targeted at improving the developer experience for building APIs. -When decorated on an assembly, all controllers in the assembly will be treated as controllers with API behavior.

What are actions?

-Public methods on a controller, except those with the NonAction attribute, are actions. Actions are either conventionally-routed or attribute-routed. -Actions can return anything, but frequently return an instance of IActionResult (or Task<IActionResult> for async methods) that produces a response. -The action method is responsible for choosing what kind of response. The action result does the responding.

What are connection strings?

-They are a way to connect to the database from your application. -A connection string contains initialization information that is passed as a parameter from a data provider to a data source. -A connection string is a semicolon-delimited list of key/value parameter pairs:

What is a Controller?

A controller is used to define and group a set of actions. An action (or action method) is a method on a controller which handles requests. Controllers logically group similar actions together. This aggregation of actions allows common sets of rules, such as routing, caching, and authorization, to be applied collectively. Requests are mapped to actions through routing.

What is ADO.NET?

A data access technology from the Microsoft .NET Framework that provides communication between relational and non-relational systems through a common set of components; a set of computer software components that programmers can use to access data and data services from a database; an evolution of ActiveX Data Objects (ADO) technology, but was changed so extensively that it can be considered an entirely new product.

What is MVC?

A design pattern used to decouple user-interface (view), data (model), and application logic (controller). This pattern helps to achieve separation of concerns. Using the MVC pattern for websites, requests are routed to a Controller that is responsible for working with the Model to perform actions and/or retrieve data. The Controller chooses the View to display, and provides it with the Model. The View renders the final page, based on the data in the Model.

What are SOLID principles?

A mnemonic acronym for five design principles intended to make software designs more understandable, flexible and maintainable.

What is ASP.NET?

A popular web-development framework for building web apps on the .NET platform.

What are RESTful APIs?

APIs that use HTTP requests to create, retrieve, update, or delete data. It is based on representational state transfer (REST), which is an architectural style and approach to communications. REST builds upon existing systems and features of HTTP.

What is an SPA?

An approach to building a web application. This approach performs most of the user interface logic in a web browser, communication with the web server primarily using web APIs.

What is the single responsibility principle?

An implementation (class / function) should perform only one task or implementation and it (class / function) should be changed for only one reason.

What is ASP.NET Core?

An open-source version of ASP.NET, that runs on macOS, Linux, and Windows. ASP.NET Core was first released in 2016 and is a re-design of earlier Windows-only versions of ASP.NET.

What are the types of Action Results?

Can be formatted in: - HTML or View - Json data

What is the difference between a web API controller and a regular Controller?

Controller derives from the ControllerBase class and adds support for views, so it's for handling web pages, not web API requests. A web API controller derives from ControllerBase.

What is model binding?

Converting client request data (form values, route data, query string parameters, HTTP headers) into objects that the controller can handle. As a result, your controller logic doesn't have to do the work of figuring out the incoming request data; it simply has the data as parameters to its action methods.

What is model validation?

Decorations to your model object with data annotation validation attributes. The validation attributes are checked on the client side before values are posted to the server, as well as on the server before the controller action is called.

What are endpoints?

Endpoints are the app's units of executable request-handling code. Endpoints are defined in the app and configured when the app starts. The endpoint matching process can extract values from the request's URL and provide those values for request processing. Using endpoint information from the app, routing is also able to generate URLs that map to endpoints.

What is the dependency inversion principle?

High-level modules should not depend on low-level modules. Both should depend on abstractions (e.g. interfaces); Abstractions should not depend on details. Details (concrete implementations) should depend on abstractions.

What is the Liskov Substitution Principle?

If S is a subtype of T, then objects of type T may be replaced with objects of type S (i.e. an object of type T may be substituted with any object of a subtype S) without altering any of the desirable properties of the program (correctness, task performed, etc.)

What are fundamentals that a developer should consider when working to wire up model binding correctly?

If sending an HTTP request that contains a form, the form should have the corresponding properties in html tags to ensure the correct attribute matches the property in the model. Essentially, the model binder needs to be able to find the corresponding property and developers should ensure that it's able to match to an incoming property.

What is Model Binding (ASP.Net) and why is it important?

Model Binding is the process by which ASP.NET Core MVC takes an HTTP request and "binds" pieces of that request, as well as other data sources, to inputs (e.g. parameters) on a controller action. It is important because programmers no longer have to write considerable amount of code that could be error-prone.

What is the interface-segregation principle?

No client should be forced to depend on methods it does not use.

What is REST?

Representational State Transfer

What are all the different types of validations that these attributes let you perform?

Required Range RegularExpression DataType EnumDataType Validation StringLength

What is routing?

Routing is responsible for matching incoming HTTP requests and dispatching those requests to the app's executable endpoints.

What is the open-closed principle?

Software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification.

What are all the different types of validations that these attributes let you perform?

Some classes included in the System.ComponentModel.DataAnnotations namespace are: - Required - Specifies that a data field value is required. - Range - Specifies the numeric range constraints for the value of a data field. - Max/Min Length - Specifies the maximum/minimum length of array or string data allowed in a property. - String Length - Specifies the minimum and maximum length of characters that are allowed in a data field. - Email - Validates an email address. - Phone - Specifies that a data field value is a well-formed phone number. - Data Type - Specifies the name of an additional type to associate with a data field. - Validation - Serves as the base class for all validation attributes.

Under which namespace do these attributes live in?

The System.ComponentModel.DataAnnotations namespace provides attribute classes that are used to define metadata for ASP.NET MVC and ASP.NET data controls.

What is the Controller component?

The component is 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.

What is the View component?

The component is used for all the UI logic of the application.

What is the Model component?

This 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.

How can you add data validation to a model?

We can use the namespace System.ComponentModel.DataAnnotations, which is a built-in set of validation attributes provided by the .NET framework.

What are RESTful webservices?

Web services based on REST Architecture are known as RESTful web services. These web services use HTTP methods to implement the concept of REST architecture. A RESTful web service usually defines a URI, Uniform Resource Identifier a service, provides resource representation such as JSON and set of HTTP Methods.

What are the different ways an HTTP request can carry data?

Working...

What kind of Web Apps can you build with ASP.NET Core?

You can build Web Apps with .NET Core using Razor, Blazor, MVCs, or using Single Page Application options, such as Angular or React.


Ensembles d'études connexes

Ancient Greece Study Set: Long and Short Answers

View Set

Health Unit 4 Test - Play It Safe!

View Set

Logic Conversion, Conversion by Limitation, Obversion, Contraposition

View Set

Chapter 25:The New Deal (1933-1939)

View Set

DMV NJ- Questions missed on the practice test- Part 1

View Set

Sentence transformation: Rewrite the sentence using the word given, use between 2 and 5 words

View Set