Skip to content

[WRN] More than twenty 'IServiceProvider' instances have been created for internal use by Entity Framework #4

Description

@unknownuser90

I use your extensions to support the functionality of the hints in my app. But after some time EF starts to write the following messages to the logs:

More than twenty 'IServiceProvider' instances have been created for internal use by Entity Framework. This is commonly caused by injection of a new singleton service instance into every DbContext instance. For example, calling UseLoggerFactory passing in a new instance each time--see https://go.microsoft.com/fwlink/?linkid=869049 for more details. Consider reviewing calls on 'DbContextOptionsBuilder' that may require new service providers to be built.

If I disable registration of RalmsExtendFunctions() then the warning in the logs disappears.
The code for the DbContext configuration looks like this:

services.AddDbContext<DbContext>(options =>
    options
        .UseSqlServer("connection string")
        .RalmsExtendFunctions());

Activity

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

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions