PooledDbContextFactory<TContext> Class
Definition
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.
A factory returning pooled DbContext instances. Disposing the instance returned by this factory returns them to the internal pooling mechanism.
public class PooledDbContextFactory<TContext> : Microsoft.EntityFrameworkCore.IDbContextFactory<TContext> where TContext : DbContext
type PooledDbContextFactory<'Context (requires 'Context :> DbContext)> = class
interface IDbContextFactory<'Context (requires 'Context :> DbContext)>
Public Class PooledDbContextFactory(Of TContext)
Implements IDbContextFactory(Of TContext)
Type Parameters
- TContext
- Inheritance
-
PooledDbContextFactory<TContext>
- Implements
Remarks
A service of this type is registered in the dependency injection container by the EntityFrameworkServiceCollectionExtensions.AddDbContextPool methods.
See Using DbContext with dependency injection, Using DbContext factories, and Using DbContext pooling for more information and examples.
Constructors
PooledDbContextFactory<TContext>(DbContextOptions<TContext>, Int32) |
Initializes a new instance of the PooledDbContextFactory<TContext> class. |
PooledDbContextFactory<TContext>(IDbContextPool<TContext>) |
This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release. |
Methods
CreateDbContext() |
Creates a new DbContext instance. |
CreateDbContextAsync(CancellationToken) |
Creates a new DbContext instance in an async context. |
Applies to
Entity Framework