Skip to content

Conversation

@bkarakaya01
Copy link

Summary

Introduces two new overloads (parameterless + poolSize) that delegate to the existing
(IServiceProvider, DbContextOptionsBuilder) overload with a no-op action.

Aligns pooled factory ergonomics with the centralized configuration model
ConfigureDbContext<TContext>.

Keeps full backward compatibility; no existing signature or behavior changed.


Motivation

When using ConfigureDbContext<TContext>, callers shouldn’t have to pass an extra configuration lambda
to pooled factory registration; options should flow automatically.


Design

  • New overloads simply call the existing overload with static (_, __) => { }.
  • XML docs reference the related ConfigureDbContext overload; no behavioral drift.
  • No changes to pooling internals, service lifetimes, or registrations.

Tests

Added AddPooledDbContextFactoryParameterlessTest covering:

  • ✅ Parameterless factory honors ConfigureDbContext provider (InMemory).
  • ✅ Custom poolSize overload resolves correctly.
  • ✅ Scoped resolution of TContext works.
  • ✅ Pool is registered as singleton.
  • ✅ Without configuration, first provider use throws.

Compatibility

  • Additive public API only.
  • No source or binary breaking changes.
  • Full XML documentation provided for all new public members.

Issues

Fixes #34658

…ctory<TContext>

Align pooled factory with EF9 ConfigureDbContext<TContext> model.
Adds two parameterless overloads (default + poolSize) delegating to the existing overload.
Includes tests verifying provider configuration flows via ConfigureDbContext.

Fixes dotnet#34657
@bkarakaya01 bkarakaya01 requested a review from a team as a code owner November 12, 2025 11:23
@bkarakaya01
Copy link
Author

@dotnet-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants