Add a pubternal way to clear ServiceProviderCache
As a workaround for issues like #27169
Is this still a priority?
@MeWagh It was never a priority. See release planning for information on how we decide what to work on.
Understood, thanks.
Hello can I take this issue?
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?
@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 https://github.com/npgsql/efcore.pg/issues/3086).