You're just starting with ASP.NET Core and Entity Framework. You've created your entity classes, but now you need a way to interact with the database. Which class should you create to manage this?
- DbContext
- DbSet
- SqlConnection
- EntityConnection
In Entity Framework Core, the DbContext class is responsible for managing database connections, tracking changes, and serving as the main entry point for interacting with the database. It provides a bridge between your entity classes and the underlying database, allowing you to perform operations like querying, inserting, updating, and deleting data.
Loading...
Related Quiz
- You're developing a web application and need to implement a feature where users can log in using their email or phone number. How can ASP.NET Core Identity support this requirement?
- In a situation where you're building a single-page application (SPA) with a default index.html, which middleware ensures that the file is served when a user accesses the root URL?
- How does the .NET SDK relate to the .NET runtime in the context of application development and deployment?
- In ASP.NET Core, how can you enforce an authenticated user to have a specific role to access a resource?
- You're refactoring a legacy ASP.NET Core project, and you see repetitive namespace imports in various Razor views. What would be the best approach to clean up and organize these imports?