Junior
From PDF
EF Core
Entity Framework Core
What is a DbContext?
Short answer: What responsibilities does it have? DbContext is the primary class for interacting with the database in EF Core. It: Manages database connections Tracks changes to entities Provides methods for querying and saving data Configures models and relationships
Real-world example (ShopNest)
ShopNest registers AppDbContext as scoped. One HTTP request = one context. Never inject it as a singleton.
Say this in the interview
- Define — one clear sentence (the short answer above).
- Example — relate it to a project like ShopNest or your real work.
- Trade-off — when you would not use it.
Share this Q&A
Share preview image: https://www.toolliyo.com/images/toolliyo-logo.png