What's the main difference between using Database.EnsureCreated() and Migrations in Entity Framework Core?

  • Database.EnsureCreated() creates a database if it doesn't exist, ignoring migrations
  • Migrations allow for version control and tracking of database schema changes
  • Database.EnsureCreated() is used for unit testing only
  • Migrations are slower than EnsureCreated()
The main difference is that Database.EnsureCreated() creates a database without tracking schema changes, often used for development or unit testing, whereas migrations provide version control for your database schema, allowing you to apply, rollback, and manage changes over time.

Continuous _________ is a software development practice where changes in the code are automatically tested and prepared for a release to production.

  • Integration
  • Deployment
  • Testing
  • Delivery
Continuous Delivery is a software development practice where changes are automatically tested and prepared for release to production. It includes automated testing, deployment, and delivery of code changes.

For a Web API, you're required to ensure that only authenticated users can access specific endpoints, but some endpoints should be public. How would you achieve this in ASP.NET Core?

  • Use Authentication Filters
  • Use Authorization Filters
  • Configure Middleware
  • Use Role-Based Authorization
To control access to specific endpoints in an ASP.NET Core Web API, you'd use Authorization Filters. You can apply policies to controllers or actions, and these filters can determine whether a user is authorized to access the resource based on their identity and role. To make some endpoints public, you can use AllowAnonymous attribute or configure policies accordingly.

Which template should you choose when you need both Razor-based web pages and API controllers?

  • Web Application
  • Web API
  • Empty
  • Blazor
The "Web Application" template is the suitable choice when you need both Razor-based web pages for user interfaces and API controllers for handling data interactions. This template provides a balanced setup for creating web applications that combine server-rendered Razor pages with APIs for data exchange.

What purpose do Razor Tag Helpers serve in ASP.NET Core?

  • Simplify server-side code in Razor views
  • Generate CSS styles
  • Handle routing in controllers
  • Create REST APIs
Razor Tag Helpers in ASP.NET Core simplify server-side code in Razor views by providing a more natural way to work with HTML elements and attributes. They make it easier to integrate server-side logic into your views while maintaining clean and readable code.

What is the primary purpose of the Register action in a typical ASP.NET Core Identity controller?

  • Allowing users to log in
  • Handling user registration
  • Managing user profiles
  • Deleting user accounts
The primary purpose of the Register action in an ASP.NET Core Identity controller is to handle user registration. It processes user-provided information, such as username, password, and email, and creates a new user account in the system, allowing them to log in subsequently.

Your team is implementing a Continuous Integration (CI) pipeline for an ASP.NET Core application. What is the main reason for integrating automated tests into this CI pipeline?

  • Ensure Code Quality
  • Speed Up Deployment
  • Reduce Server Costs
  • Simplify Documentation
The main reason for integrating automated tests into a CI pipeline is to ensure code quality. Automated tests help catch bugs early in the development process, improve the reliability of the application, and provide confidence that changes won't introduce regressions. This ultimately leads to a higher-quality product.

Which file extension is typically used to define shared Razor directives that can be utilized across multiple views?

  • .cshtml
  • .layout
  • .razordirectives
  • .razorimports
The file extension typically used to define shared Razor directives that can be utilized across multiple views is .razorimports. This file allows you to specify common directives or 'using' statements that should apply to multiple Razor views, streamlining your code and maintaining consistency.

Which of the following best describes a primary feature of ASP.NET Core Identity?

  • User Registration and Management
  • Image Compression
  • Video Editing
  • Network Routing
A primary feature of ASP.NET Core Identity is user registration and management. It allows you to create, update, and manage user accounts, including features like user registration, login, password reset, and role-based access control (RBAC).

How does the UseExceptionHandler middleware differ from the UseDeveloperExceptionPage middleware in ASP.NET Core?

  • UseExceptionHandler displays custom error pages to users
  • UseDeveloperExceptionPage is used only in production
  • UseExceptionHandler is for development use only
  • UseDeveloperExceptionPage is more secure
The UseExceptionHandler middleware is used to display custom error pages to users when an unhandled exception occurs. UseDeveloperExceptionPage, on the other hand, shows detailed exception information during development, but it's not suitable for production as it can leak sensitive information.