General Flashcards

1
Q

You want to disable your application from launching on the browser as soon as you run the project. You want to change the port as well. In what file is this possible?

A

LaunchSettings.json. Port changes are inside the IIS settings and launchBrowser within profiles.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the name of the file where you set configuration values for the app?

A

appsettings.json

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How can you set different configurations for different environments?

A

Create additional appsettings files, suffixed with ‘.Development’ and ‘.Production’ .json.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What’s the name of the interface you use to retrieve values in appsettings.json?

A

Iconfiguration

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the method used to retrieve a section from appsettings.json?

A

configuration.GetSection(“sectionName”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the entry point of every ASP.NET Core Web API application?

A

Program.cs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the name of file that allows configuration of the services and middleware used in the API?

A

startup.cs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What methods exist in the startup.cs file, and what is their purpose?

A

ConfigureServices Method: configure the services used within the app.
Configure method: Configuration of the app’s middleware pipeline

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How can you extend an objects behavior, besides inheritance?

A

Create an extension method.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you create an extension method?

A

Create a new static class and within, the static method that will extend the behavior of the desired object. This method will have ‘this’ as its first parameter together with the type that will be extended.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

what are the three ways to register services in ASP.NET Core in the IoC container?

A

AddSingleton, AddScoped, AddTransient

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does services.AddSingleton do?

A

Creates a service once and provides the same instance for each subsequent call.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What does services.AddScoped do?

A

Creates a new service for each Http request.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does services.AddTransient do?

A

Creates a new service every single time it’s requested.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the purpose of models / entities in Entity Framework Core?

A

They are classes that represent the table structure of the database, with properties that are used in the construction of the columns and defining the relationship with other models.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a DTO and what is its purpose?

A

A data transfer object, used to exchange data between the client and server rather than the entity used in the database.