Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
DbContextOptionsBuilder.EnableServiceProviderCaching(Boolean) Method
Definition
- Namespace:
- Microsoft.EntityFrameworkCore
- Assembly:
- Microsoft.EntityFrameworkCore.dll
- Package:
- Microsoft.EntityFrameworkCore v10.0.0
- Package:
- Microsoft.EntityFrameworkCore v3.0.0
- Package:
- Microsoft.EntityFrameworkCore v3.1.0
- Package:
- Microsoft.EntityFrameworkCore v5.0.0
- Package:
- Microsoft.EntityFrameworkCore v6.0.0
- Package:
- Microsoft.EntityFrameworkCore v7.0.0
- Package:
- Microsoft.EntityFrameworkCore v8.0.0
- Package:
- Microsoft.EntityFrameworkCore v9.0.0
- Source:
- DbContextOptionsBuilder.cs
- Source:
- DbContextOptionsBuilder.cs
- Source:
- DbContextOptionsBuilder.cs
- Source:
- DbContextOptionsBuilder.cs
- Source:
- DbContextOptionsBuilder.cs
- Source:
- DbContextOptionsBuilder.cs
- Source:
- DbContextOptionsBuilder.cs
- Source:
- DbContextOptionsBuilder.cs
Important
Some information relates to prerelease product that may be substantially modified before itβs released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Enables or disables caching of internal service providers. Disabling caching can massively impact performance and should only be used in testing scenarios that build many service providers for test isolation.
public virtual Microsoft.EntityFrameworkCore.DbContextOptionsBuilder EnableServiceProviderCaching(bool cacheServiceProvider = true);
abstract member EnableServiceProviderCaching : bool -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
override this.EnableServiceProviderCaching : bool -> Microsoft.EntityFrameworkCore.DbContextOptionsBuilder
Public Overridable Function EnableServiceProviderCaching (Optional cacheServiceProvider As Boolean = true) As DbContextOptionsBuilder
Parameters
- cacheServiceProvider
- Boolean
If true, then the internal service provider is cached.
Returns
The same builder instance so that multiple calls can be chained.
Remarks
Note that if the application is setting the internal service provider through a call to UseInternalServiceProvider(IServiceProvider), then setting this option will have no effect.
See Using DbContextOptions for more information and examples.
Applies to
Entity Framework
Feedback
Was this page helpful?
