Question
I have a large context model, so I'm experimenting with context pooling.
My current setup is:
service.AddDbContextPool<AppDbContext>((provider, optionsBuilder) =>
{
AppDbContextOptionsFactory.Get(optionsBuilder);
});
When I run my app, everything seems to work ok, except the active_dbcontexts seems to indicate the pooled dbcontexts are created but never released. Is this the expected behaviour for this?

From debugging with EFCore symbols, it appears that AddDbContextPool uses a ScopedDbContextFactory that does not allow the lease to be released because IsStandalone is set to false.
EF Core version
9.0.0
Database provider
SqlServer
Target framework
.Net 9
Operating system
Windows 10
IDE
vs 2022
Question
I have a large context model, so I'm experimenting with context pooling.
My current setup is:
When I run my app, everything seems to work ok, except the
active_dbcontextsseems to indicate the pooled dbcontexts are created but never released. Is this the expected behaviour for this?From debugging with EFCore symbols, it appears that
AddDbContextPooluses aScopedDbContextFactorythat does not allow the lease to be released becauseIsStandaloneis set to false.EF Core version
9.0.0
Database provider
SqlServer
Target framework
.Net 9
Operating system
Windows 10
IDE
vs 2022