title
stringlengths
3
46
content
stringlengths
0
1.6k
Answers:144
Write operations.
Answers:145
The main weaknesses of NoSQL databases are their consistency and transactions, while their main advantage is performance, especially when it comes to handling distributed writes.
Answers:146
Eventual, Consistency Prefix, Session, Bounded Staleness, and Strong.
Answers:147
No, they are not efficient in a distributed environment. GUID-based strings perform better, since their uniqueness is automatic and doesn’t require synchronization operations.
Answers:148
OwnsMany and OwnsOne.
Answers:149
Yes, they can. Once you use SelectMany, indices can be used to search for nested objects.
Answers:150
Answers:151
Chapter 13
Answers:152
Answers:153
With the help of database-dependent providers.
Answers:154
Either by calling them Id or by decorating them with the Key attribute. This can also be done with a fluent configuration approach.
Answers:155
With the MaxLength and MinLength attributes, or with their equivalent fluent configuration methods.
Answers:156
With something similar to builder.Entity<Package>().HasIndex(m => m.Name);.
Answers:157
With something similar to the following:
Answers:158
builder.Entity<Destination>()
Answers:159
.HasMany(m => m.Packages)
Answers:160
.WithOne(m => m.MyDestination)
Answers:161
.HasForeignKey(m => m.DestinationId)
Answers:162
.OnDelete(DeleteBehavior.Cascade);
Answers:163
Answers:164
Answers:165
With Add-Migration and Update-Database in the package-manager console, or with dotnet ef migrations add and dotnet ef database update in the operating system console.
Answers:166
No, but you can forcefully include them with the Include LINQ clause or by using the UseLazyLoadingProxies option when configuring your DbContext. With Include, related entities are loaded together with the main entities, while with UseLazyLoadingProxies, related entities are lazy-loaded; that is, they are loaded as soon as they are required.
Answers:167
Yes, it is, thanks to the Select LINQ clause.
Answers:168
By calling context.Database.Migrate().
Answers:169
Answers:170
Chapter 14
Answers:171
Answers:172
Because using queues are the only way to avoid time-consuming blocking calls.
Answers:173
With the import declaration.
Answers:174
With the standard Duration message.
Answers:175
Version compatibility and interoperability while maintaining good performance.
Answers:176
Better horizontal scalability, and support for the Publisher/Subscriber pattern.
Answers:177
For two reasons. The operation is very fast, and the insertion in the first queue of a communication path must necessarily be a blocking operation. At least one blocking operation is always necessary to store the message in some permanent storage (usually a queue), so it can be recovered if the ongoing processing might fail for some reason.
Answers:178
With the following XML code:
Answers:179
<ItemGroup>
Answers:180
<Protobuf Include=`Protosfile1.proto` GrpcServices=`Server/Client` />
Answers:181
<Protobuf Include=`Protosfile2.proto` GrpcServices=`Server/Client` />
Answers:182
...
Answers:183
</ItemGroup>
Answers:184
Answers:185
Answers:186
Answers:187
Where Protosfile1.proto and Protosfile2.proto must be replaced with the actual paths to the ProtoBuf files within our project. Moreover, the GrpcServices attribute must be set to `Server` or `Client`, depending on whether the proto file describes a server or not.
Answers:188
Answers:189
With channel.BasicPublish(…).
Answers:190
With channel.WaitForConfirmsOrDie(timeout).
Answers:191
Answers:192
Chapter 15
Answers:193
Answers:194
No, since this would violate the principle that a service reaction to a request must depend on the request itself, and not on other messages/requests that had previously been exchanged with the client.
Answers:195
No, implementing a service with a custom communication protocol is generally not good practice because it compromises interoperability, increases development and maintenance complexity, and isolates the service from widely used standards and tools. Standard protocols such as HTTP/REST, gRPC, and others are preferred for their broad support, ease of integration, and community backing.
Answers:196
Yes, it can. The primary action of a POST must be creation, but deletion can be performed as a side effect. The HTTP verb to use is determined by the virtual table named in the URL (in our case, a POST, since the operation is an addition), but other operations can be performed on other virtual tables that are not mentioned in the URL as side effects.
Answers:197
Three; they are Base64 encoding of the header, Base64 encoding of the body, and the signature.
Answers:198
From the request body.
Answers:199
The ApiController attribute sets up some default behaviors that help in the implementation of REST services.
Answers:200
The ProducesResponseType attribute.
Answers:201
When using API controllers, they are declared with the Route and Http<verb> attributes. When using a minimal API, they are declared in the first argument of MapGet, MapPost, … Map{Http verb}.
Answers:202
By adding something like builder.Services.AddHttpClient<MyProxy>() in the dependency injection part of the host configuration.
Answers:203
Answers:204
Chapter 16
Answers:205
Answers:206
Azure Functions is an Azure PaaS component that allows you to implement FaaS solutions.
Answers:207
You can program Azure Functions in different languages, such as C#, F#, PHP, Python, and Node.js. You can also create functions using the Azure portal and Visual Studio Code. Additional stacks can be used by using custom handlers: https://docs.microsoft.com/en-au/azure/azure-functions/functions-custom-handlers.
Answers:208
There are two plan options in Azure Functions. The first plan is the Consumption Plan, where you are charged according to the amount you use. The second plan is the App Service Plan, where you share your App Service resources with the function’s needs.
Answers:209
The process of deploying functions in Visual Studio is the same as in web app deployment.
Answers:210
There are lots of ways we can trigger Azure Functions, such as using Blob Storage, Cosmos DB, Event Grid, Event Hubs, HTTP, Microsoft Graph Events, Queue Storage, Service Bus, Timer, and Webhooks.
Answers:211
Azure Functions v1 needs the .NET Framework Engine, whereas v2 needs .NET Core 2.2, and v3 needs .NET Core 3.1 and .NET 5-6. v4 is the current version for .NET 6, 7, and 8.
Answers:212
The execution of every Azure function can be monitored by Application Insights. Here, you can check the time it took to process, resource usage, errors, and exceptions that happened in each function call.
Answers:213
They are functions that will let us write stateful workflows, managing the state behind the scenes.
Answers:214
Answers:215
Chapter 17
Answers:216
Answers:217
Typical middleware modules scaffolded by Visual Studio in an ASP.NET Core project include a developer exception page, request routing, static file serving, HTTPS redirection, authentication, and authorization.
Answers:218
No.
Answers:219
False. Several tag helpers can be invoked on the same tag.
Answers:220
ModelState.IsValid.
Answers:221
@RenderBody().
Answers:222
We can use @RenderSection(`Scripts`, required: false).
Answers:223
We can use return View(`viewname`, ViewModel).
Answers:224
Three providers are included in ASP.NET Core, but they must be configured. If different providers are needed, they must be implemented by the developers and added to the providers list.
Answers:225
No, ViewModels are not the only way for controllers to communicate with views in ASP.NET Core. Controllers can also use ViewData, ViewData, and TempData to pass data to views.
Answers:226
Answers:227
Chapter 18
Answers:228
Answers:229
API gateways work as interfaces for API microservices, while frontends take care of building web pages’ HTML.
Answers:230
Robust web servers optimize the whole request/response handling and ensure the needed level of security.
Answers:231
Because they have an impact on performance that is usually unacceptable for high-traffic microservices.
Answers:232
When transactions are quite fast and the probability of collision between transactions is low.
Answers:233
A better decoupling of the aggregates and commands methods.
Answers:234
Answers:235
Chapter 19
Answers:236
Answers:237
It is a W3C standard: the assembly of a virtual machine running in W3C-compliant browsers.
Answers:238
A web UI where dynamic HTML is created in the browser itself.
Answers:239
Selecting a page based on the current browser URL.
Answers:240
A Blazor component with routes attached to it. For this reason, the Blazor router can select it.
Answers:241
Defining the .NET namespace of a Blazor component class.
Answers:242
A local service that takes care of storing and handling all form-related information, such as validation errors and changes in HTML inputs.
Answers:243
Either OnInitialized or OnInitializedAsync.