Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a pubternal way to clear ServiceProviderCache #27189

Open
AndriySvyryd opened this issue Jan 14, 2022 · 6 comments
Open

Add a pubternal way to clear ServiceProviderCache #27189

AndriySvyryd opened this issue Jan 14, 2022 · 6 comments
Labels
area-dbcontext good first issue This issue should be relatively straightforward to fix. type-enhancement
Milestone

Comments

@AndriySvyryd
Copy link
Member

As a workaround for issues like #27169

@ajcvickers ajcvickers added area-dbcontext good first issue This issue should be relatively straightforward to fix. labels Jan 14, 2022
@ajcvickers ajcvickers added this to the Backlog milestone Jan 14, 2022
@MeWagh
Copy link

MeWagh commented Jun 13, 2022

Is this still a priority?

@ajcvickers
Copy link
Member

@MeWagh It was never a priority. See release planning for information on how we decide what to work on.

@MeWagh
Copy link

MeWagh commented Jun 13, 2022

Understood, thanks.

@BekAllaev
Copy link

Hello can I take this issue?

@gbd3-en
Copy link

gbd3-en commented Feb 15, 2024

This impacts us as well. We rotate our NpgsqlDataSource every 12 hours. Even though we properly Dispose the old data sources and DbContext's, we eventually get:

'Microsoft.EntityFrameworkCore.Infrastructure.ManyServiceProvidersCreatedWarning':
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.

Is there any way at all to get EF core to remove the old service providers?

@roji
Copy link
Member

roji commented Feb 15, 2024

@gbd3-en the plan on the EFCore.PG side is to stop creating new EF service providers for different NpgsqlDataSources - that should take care of your usecase (see npgsql/efcore.pg#3086).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-dbcontext good first issue This issue should be relatively straightforward to fix. type-enhancement
Projects
None yet
Development

No branches or pull requests

6 participants