Lyra
Learn
AI Learning Platform
π Midnight
π Comfort
π₯ Ember
π Paper
β Contrast
Exams
Sign in to track progress
β Back to the lesson
Module 5 Β· Quiz
DbContext and the Model
1. What is the primary role of DbContext in Entity Framework Core?
Tracks changes to entities
Defines the database schema
Creates views for the application
Manages user authentication
2. What is the recommended lifetime for a DbContext instance in a web application?
Singleton
One per HTTP request
One per query
Permanent across application lifetime
3. Which method is used to register a DbContext in the application's service container?
builder.Services.AddMvc()
builder.Services.AddScoped()
builder.Services.AddDbContext()
builder.Services.ConfigureDbContext()
4. Which of the following configurations allows for expressions of complex relationships and mapping in EF Core?
Data annotations
LINQ queries
DbContext methods
Fluent API
Submit answers
Continue: Querying Well β
Review this lesson
Retake quiz