Which protocol does SignalR use primarily before falling back to other techniques?
- WebSocket
- HTTP
- FTP
- TCP
SignalR primarily uses the WebSocket protocol for real-time communication due to its low latency and bidirectional capabilities. WebSocket provides a full-duplex communication channel, making it ideal for applications requiring instant updates. SignalR gracefully falls back to other techniques like HTTP long polling or Server-Sent Events for compatibility with older browsers or network restrictions.
In an ASP.NET Core project, where are the application's dependencies and SDKs defined?
- appsettings.json
- Startup.cs
- project.json
- .csproj files
In an ASP.NET Core project, application dependencies and SDK versions are typically defined in the .csproj files. These files specify the packages, libraries, and tools required for the project. The .csproj files play a crucial role in managing the project's dependencies and ensuring the correct versions are used.
You've just started working on an ASP.NET Core project that uses Identity for user management. What are migrations primarily used for in this context?
- Managing the database schema
- Managing user authentication
- Managing user roles
- Managing user sessions
In an ASP.NET Core project with Identity, migrations are primarily used for managing the database schema. They allow you to create, update, and version your database schema as your application evolves. This is crucial for user management as it involves the creation and maintenance of user-related tables.
SignalR is known for enabling ________ communication, which allows the server to push content to connected clients.
- Real-time
- Batch
- Asynchronous
- Synchronous
SignalR is a library in ASP.NET Core known for enabling real-time communication. It allows the server to push content to connected clients in real-time, making it ideal for applications that require instant updates, such as chat apps and live dashboards.
When combining multiple [Authorize] attributes on a single action or controller, how does ASP.NET Core evaluate the requirements?
- Logical AND
- Logical OR
- Randomly
- Sequentially
ASP.NET Core evaluates the requirements of multiple [Authorize] attributes logically using AND. This means all authorization requirements specified in these attributes must be met for a user to access the action or controller.
You're new to ASP.NET Core and are confused about where to specify the common design elements (like headers and footers) that appear on every page. Which Razor concept should you explore for this purpose?
- ViewComponents
- Razor Layouts
- Partial Views
- Tag Helpers
To specify common design elements like headers and footers that appear on every page, you should explore Razor Layouts. Razor Layouts allow you to define a shared layout for your views, enabling you to encapsulate these common elements.
In an ASP.NET Core project, the ________ folder is used to store view templates for MVC applications.
- Views
- Models
- Controllers
- Services
In ASP.NET Core MVC applications, the "Views" folder is used to store view templates. Views are responsible for rendering the user interface and displaying data to the user. They are typically associated with controller actions and define how the data is presented to the user.
In the context of Entity Framework Core, what is the "N+1" problem, and how can it affect database performance?
- A problem related to mathematical calculations in EF Core
- A performance issue where each related entity is loaded individually
- A database schema design issue
- An error in LINQ queries
The "N+1" problem refers to a performance issue in Entity Framework Core where related entities are loaded individually in a loop instead of being loaded together with the main entity. This can lead to a large number of database queries and significantly affect database performance.
When securing ASP.NET Core applications, the ________ attribute can be applied to ensure certain actions or controllers are accessible only to authenticated users.
- [Authorize]
- [AllowAnonymous]
- [RequireHttps]
- [ValidateAntiForgeryToken]
The [Authorize] attribute in ASP.NET Core is used to secure actions or controllers by specifying that only authenticated users are allowed access. It is a fundamental part of ASP.NET Core's security infrastructure.
Which method is typically used to sign a user out in ASP.NET Core?
- Logout()
- SignOut()
- TerminateSession()
- Disconnect()
The typical method used to sign a user out in ASP.NET Core is SignOut(). It clears the user's authentication cookies or tokens, effectively ending their authenticated session.