Class DatabaseProvider<TOptionsExtension>
- Namespace
- Microsoft.EntityFrameworkCore.Storage
- Assembly
- Microsoft.EntityFrameworkCore.dll
The primary point where a database provider can tell EF that it has been selected for the current context.
This type is typically used by database providers (and other extensions). It is generally not used in application code.
public class DatabaseProvider<TOptionsExtension> : IDatabaseProvider where TOptionsExtension : class, IDbContextOptionsExtension
Type Parameters
TOptionsExtension
The type of options that the database provider will add to Extensions to identify that is has been selected (and to store its database specific settings).
- Inheritance
-
DatabaseProvider<TOptionsExtension>
- Implements
- Inherited Members
Remarks
The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.
See Implementation of database providers and extensions for more information and examples.
Constructors
DatabaseProvider(DatabaseProviderDependencies)
Initializes a new instance of the DatabaseProvider<TOptionsExtension> class.
public DatabaseProvider(DatabaseProviderDependencies dependencies)
Parameters
dependencies
DatabaseProviderDependenciesParameter object containing dependencies for this service.
Properties
Dependencies
Dependencies for this service.
protected virtual DatabaseProviderDependencies Dependencies { get; }
Property Value
Name
The unique name used to identify the database provider. This should be the same as the NuGet package name for the providers runtime.
public virtual string Name { get; }
Property Value
Version
The value of the InformationalVersion for the database provider assembly.
public virtual string? Version { get; }
Property Value
Methods
IsConfigured(IDbContextOptions)
Gets a value indicating whether this database provider has been selected for a given context.
public virtual bool IsConfigured(IDbContextOptions options)
Parameters
options
IDbContextOptionsThe options for the context.