You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a parameterless AddPooledDbContextFactory overload #34658
Why does the EF Core 9 method AddPooledDbContextFactory<> doesn't have a parameterless method, like AddDbContextFactory<> ?
I'm using the DbContext in two different way: AddDbContext<> for my MVC pages AddPooledDbContextFactory<> for my Blazor components integrated in my MVC app
However, I need to switch back to AddDbContextFactory, because the AddPooledDbContextFactory doesn't have any parameterless method and beause of the new way to handle configuration, I need to call ConfigureDbContext<>(opt=>{...}) before my registrations to avoid exceptions.
EF Core version: EF Core 9 RC1
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 9
Operating system: Windows 11
IDE: Visual Studio 2022 17.12 p2
changed the title [-]EF Core 9 ConfigureDbContext and PooledDbContextFactory[/-][+]Add a parameterless AddPooledDbContextFactory overload[/+]on Sep 13, 2024
@AndriySvyryd Hum, not sure about this...
When I do that, I have en exception: System.InvalidOperationException : 'The property ConnectionString wasn't initialized.'
It only happens when I use DbContexts from the factory
Opened PR #37144 to implement this enhancement (adds parameterless and poolSize overloads for AddPooledDbContextFactory, with tests).
Maintains full backward compatibility. Would appreciate your guidance or review when convenient.
Activity
AndriySvyryd commentedon Sep 13, 2024
@christophe-mommer You should be able to call
.AddPooledDbContextFactory<T>(_ => {})[-]EF Core 9 ConfigureDbContext and PooledDbContextFactory[/-][+]Add a parameterless AddPooledDbContextFactory overload[/+]christophe-mommer commentedon Sep 15, 2024
@AndriySvyryd Hum, not sure about this...
When I do that, I have en exception:
System.InvalidOperationException : 'The property ConnectionString wasn't initialized.'It only happens when I use DbContexts from the factory
Here's my configuration:
AndriySvyryd commentedon Sep 16, 2024
I tried this and it works fine. Can you share a small console app runnable project that shows the exception?
bkarakaya01 commentedon Nov 12, 2025
Opened PR #37144 to implement this enhancement (adds parameterless and poolSize overloads for AddPooledDbContextFactory, with tests).
Maintains full backward compatibility. Would appreciate your guidance or review when convenient.
AndriySvyryd commentedon Mar 27, 2026
Fixed in 8132028