Skip to main content
InterviewHubPRO
Section Overview
Q25

Question 25 of 50

Part 3: Distributed Systems, Kestrel Internals & Scalability (25 - 35)

50%
ASP.NET Core & Web API (50 Qs)•Part 3: Distributed Systems, Kestrel Internals & Scalability (25 - 35)

What is the difference between `AddDbContext` vs. `AddDbContextPool`?

senior LevelSystem Design

In Simple Words:

  • AddDbContext: Instantiates a new DbContext instance per HTTP request and discards it after.
  • AddDbContextPool: Maintains a pool of reusable DbContext instances. After a request completes, EF Core resets the context state and returns it to the pool, eliminating allocation overhead for high-traffic APIs.