This EF Core class represents a session with the database, tracking changes and managing entity queries and saves. It's also where you define your database tables.
What is a DbContext?
This .NET Core class handles incoming HTTP requests, coordinates application logic or services, and returns appropriate responses like JSON or status codes.
What is a controller?
This object-oriented programming principle allows a class to reuse the properties and methods of another class, forming a parent-child relationship.
What is inheritance?
You have a list of IGameCharacter objects that includes Warrior, Mage, and Archer. When you call TakeTurn() on each one, they all behave differently, without needing to know which type they are. This behavior demonstrates what object-oriented concept?
You’re building a user profile system and need to display a user's age. What data type should you use to store this data in your database?
What is a DateOnly?
This EF Core feature tracks changes to your data model and generates code to update the database schema accordingly, without losing existing data.
What is a database migration?
This application-wide mechanism catches unhandled errors and returns consistent, safe responses, often configured in middleware to avoid repetitive try/catch blocks in every controller.
What is a global exception handler?
This C# construct defines a contract of method signatures that multiple unrelated classes can implement, allowing for flexible and consistent behavior across types.
What is an interface?
This design principle involves providing a class with its required dependencies, like services or repositories, from the outside, rather than creating them internally, improving flexibility, maintainability, and separation of concerns.
What is dependency injection?
You have a list of users, and every time someone logs in, you loop through the list to find the matching user by username. To improve performance, you refactor your code to look up users instantly by their username key. What data structure do you use?
What is a dictionary?
These two methods are found in EF Core migration files. One defines the changes to apply to the database, and the other defines how to reverse them.
What are Up() and Down()?
This design pattern abstracts data access logic into a separate layer, allowing you to manage querying and persistence without exposing the underlying database or ORM directly to your business logic.
What is the repository pattern?
This object-oriented concept allows objects of different classes to be treated through the same interface or base type, with each class providing its own implementation of shared methods like Execute() or Attack().
You notice a controller that handles HTTP requests, validation, logging, and database access all in one class. To improve design, you refactor it so each part does only one thing. This follows what object-oriented principle?
What is the Single Responsibility Principle?
You’re writing a POST /api/users endpoint and consider reusing your internal User class as the request body. But it includes fields like Id, DateCreated, and IsAdmin, which clients shouldn’t set. To avoid exposing these fields and keep your API focused on required input only, what should you do instead?
What is use a Request object (DTO Pattern)
This type of property in an entity class lets you reference related data, such as a User's Orders or a Villager’s Home, and is used to define relationships in EF Core. They are used to represent 1:1, 1:*, and *:* relationships.
What are navigational properties?
This design pattern is used to transfer only the necessary data between layers or across the network, often shaping or filtering fields from your domain models to keep API responses clean and secure.
What is the Data Transfer Object (DTO) pattern?
This control structure lets you handle exceptions gracefully in C# by attempting risky code, catching errors if they occur, and optionally running cleanup code afterward no matter what.
What is a try/catch/finally block?
You create a TaxCalculator class with a method that doesn’t depend on instance data. Instead of creating an object to use it, you call the method directly on the class. What C# keyword allows this behavior?
What is static?
You’re writing a condition like
if (product.IsAvailable() && product.GetDiscount().Amount < 75)
and you intentionally check IsAvailable() first because it’s fast and likely to return false, while GetDiscount() involves a database call. This technique improves performance by avoiding unnecessary work. What is this optimization behavior called?
What is short circuiting?
These are the two types of keys used to define relationships between tables in a relational database. One uniquely identifies a row, and the other connects it to a related row in another table.
What are primary and foreign key references?
This software design pattern separates an application into three layers: controller, business logic (services), and data access (e.g., repositories or database), promoting modularity and maintainability.
What is layered (three-tiered) architecture?
This type of class cannot be instantiated on its own and is used to define shared properties or methods, often including abstract members that must be implemented by derived classes.
What is an abstract class?
You want to let child classes customize a method’s behavior, but in one case you require them to implement it, and in another you just allow them to override it optionally. What two C# keywords help you define these methods in a base class? What keyword do you use in the child class?
What are abstract, virtual, and override?
You notice you've copied the same tax calculation logic into three different controller methods. When the formula needs to change, you’ll have to update it in all three places. To avoid this maintenance headache, what software principle should you follow?
What is Don't Repeat Yourself (DRY)?