Repository: dotnet/efcore
File: src/EFCore/Extensions/EntityFrameworkServiceCollectionExtensions.cs (C#)

Code before:
            static (_, __) => { },
            DbContextPool<DbContext>.DefaultPoolSize);

    /// <summary>
    ///     Registers a pooled <see cref="IDbContextFactory{TContext}" /> in the
    ///     <see cref="IServiceCollection" /> for creating instances of the specified
    ///     <see cref="DbContext" /> type, using a custom pool size.
    /// </summary>
    /// <remarks>
    ///     <para>
    ///         This overload aligns with the EF Core centralized configuration model
    ///         <see cref="ConfigureDbContext{TContext}(IServiceCollection, Action{DbContextOptionsBuilder}, ServiceLifetime)" />
    ///         and allows specifying a custom <paramref name="poolSize"/>.  
    ///         Options configured via <c>ConfigureDbContext&lt;TContext&gt;</c> are automatically used,
    ///         eliminating the need to repeat provider configuration.
    ///     </para>
    /// </remarks>
    /// <typeparam name="TContext">
    ///     The type of <see cref="DbContext" /> to be created by the factory.
    /// </typeparam>
    /// <param name="serviceCollection">
    ///     The <see cref="IServiceCollection" /> to which the services are added.
    /// </param>
    /// <param name="poolSize">
    ///     The maximum number of <typeparamref name="TContext" /> instances retained by the pool.
    ///     The default is 1024.
    /// </param>
    /// <returns>
    ///     The same <see cref="IServiceCollection" /> so that multiple calls can be chained.
    /// </returns>
    public static IServiceCollection AddPooledDbContextFactory
        <[DynamicallyAccessedMembers(DbContext.DynamicallyAccessedMemberTypes)] TContext>(
            this IServiceCollection serviceCollection,
            int poolSize)
        where TContext : DbContext
        => AddPooledDbContextFactory<TContext>(
            serviceCollection,
            static (_, __) => { },
            poolSize);


    /// <summary>
    ///     Configures the given context type in the <see cref="IServiceCollection" />.
    /// </summary>
    /// <remarks>
    ///     <para>
    ///         <see cref="AddDbContext{TContext}(IServiceCollection,Action{DbContextOptionsBuilder},ServiceLifetime,ServiceLifetime)" />,
    ///         <see cref="AddDbContextPool{TContext}(IServiceCollection,Action{DbContextOptionsBuilder},int)" />,
    ///         <see cref="AddDbContextFactory{TContext, TFactory}(IServiceCollection,Action{DbContextOptionsBuilder}?,ServiceLifetime)" /> or
    ///         <see cref="AddPooledDbContextFactory{TContext}(IServiceCollection,Action{DbContextOptionsBuilder},int)" />
    ///         must also be called for the specified configuration to take effect.

Review comment (suggestion):
The description "The default is 1024" is misleading. This parameter doesn't have a default value in the method signature (line 1100), so users must explicitly provide it. The documentation should say something like "Sets the maximum number of instances retained by the pool." without mentioning a default, or clarify that 1024 is what the underlying pool uses, not a parameter default.
```suggestion
    ///     Sets the maximum number of <typeparamref name="TContext" /> instances retained by the pool.
```

Code after:
    /// <param name="serviceCollection">
    ///     The <see cref="IServiceCollection" /> to which the services are added.
    /// </param>
    /// <param name="poolSize">
    ///     The maximum number of <typeparamref name="TContext" /> instances retained by the pool. Defaults to 1024.
    /// </param>
    /// <returns>
    ///     The same <see cref="IServiceCollection" /> so that multiple calls can be chained.
    /// </returns>
    public static IServiceCollection AddPooledDbContextFactory
        <[DynamicallyAccessedMembers(DbContext.DynamicallyAccessedMemberTypes)] TContext>(
            this IServiceCollection serviceCollection,
            int poolSize = DbContextPool<DbContext>.DefaultPoolSize)
        where TContext : DbContext
        => AddPooledDbContextFactory<TContext>(
            serviceCollection,
            static (_, __) => { },
            poolSize);

    /// <summary>
    ///     Configures the given context type in the <see cref="IServiceCollection" />.
    /// </summary>
    /// <remarks>
    ///     <para>
    ///         <see cref="AddDbContext{TContext}(IServiceCollection,Action{DbContextOptionsBuilder},ServiceLifetime,ServiceLifetime)" />,
    ///         <see cref="AddDbContextPool{TContext}(IServiceCollection,Action{DbContextOptionsBuilder},int)" />,
    ///         <see cref="AddDbContextFactory{TContext, TFactory}(IServiceCollection,Action{DbContextOptionsBuilder}?,ServiceLifetime)" /> or
    ///         <see cref="AddPooledDbContextFactory{TContext}(IServiceCollection,Action{DbContextOptionsBuilder},int)" />
    ///         must also be called for the specified configuration to take effect.
    ///         Calling this method after any of the above will ovewrite conflicting configuration.
    ///         For non-pooled contexts <see cref="DbContext.OnConfiguring" /> configuration will be applied
    ///         in addition to configuration performed here.
    ///     </para>
    ///     <para>
    ///         This method can be invoked multiple times and the configuration will be applied in the given order.
    ///     </para>
    ///     <para>
    ///         See <see href="https://aka.ms/efcore-docs-di">Using DbContext with dependency injection</see> for more information and examples.
    ///     </para>
    /// </remarks>
    /// <typeparam name="TContext">The type of context to be registered.</typeparam>
    /// <param name="serviceCollection">The <see cref="IServiceCollection" /> to add services to.</param>
    /// <param name="optionsAction">An action to configure the <see cref="DbContextOptions" /> for the context.</param>
    /// <param name="optionsLifetime">
    ///     The lifetime with which the <see cref="DbContextOptions" /> service will be registered in the container.
    /// </param>
    /// <returns>The same service collection so that multiple calls can be chained.</returns>
    public static IServiceCollection ConfigureDbContext
        <[DynamicallyAccessedMembers(DbContext.DynamicallyAccessedMemberTypes)] TContext>(
            this IServiceCollection serviceCollection,
            Action<DbContextOptionsBuilder> optionsAction,