Class ProviderFactoryDbProvider
- Namespace
- Quartz.Impl.AdoJobStore.Common
- Assembly
- Quartz.dll
Connects through the DbProviderFactory an ADO.NET driver ships, rather than through types named in the driver description.
public sealed class ProviderFactoryDbProvider : IDbProvider
- Inheritance
-
ProviderFactoryDbProvider
- Implements
- Inherited Members
Remarks
Every ADO.NET provider exposes a singleton factory — SqlClientFactory.Instance,
NpgsqlFactory.Instance, SqliteFactory.Instance — and a factory hands back an instance
of every type the store uses: CreateConnection() for the connection,
the connection for the command, the command for its parameters. Nothing is resolved by name and
nothing is constructed by reflection, which is what a trimmed or ahead-of-time-compiled application
needs: the trimmer cannot see through Type.GetType("Npgsql.NpgsqlConnection, Npgsql"), and
removes the constructor behind it.
The driver description is still needed, because it decides how parameters are named, but it names no type. A driver that needs a command or a binary parameter configured in a way Quartz cannot name says so with ConfigureCommand and ConfigureBinaryParameter — the application references the driver, so it can name what Quartz cannot.
Public, unlike its data source sibling, because an application can hold a factory that no
Use<Db> overload knows about — one built by
GetFactory(string), or a driver's own subclass — and
UseConnectionProvider is where that goes.
Constructors
ProviderFactoryDbProvider(DbMetadata, DbProviderFactory, string)
Initializes a new instance of the ProviderFactoryDbProvider class.
public ProviderFactoryDbProvider(DbMetadata metadata, DbProviderFactory factory, string connectionString)
Parameters
metadataDbMetadataThe driver description. Only what the description says about parameter naming and the two typed seams is read; the types on it, if any, are ignored, because nothing here constructs one.
factoryDbProviderFactoryThe driver's factory, normally its
Instancesingleton.connectionStringstringThe connection string every connection is opened with.
Properties
ConnectionString
Connection string used to create connections. Arrives through the implementation's constructor; a provider is fully usable once constructed.
public string ConnectionString { get; }
Property Value
Metadata
The database metadata for the provider.
public DbMetadata Metadata { get; }
Property Value
Methods
CreateCommand()
Returns a new command object for executing SQL statements/Stored Procedures against the database.
public DbCommand CreateCommand()
Returns
- DbCommand
An new IDbCommand
Remarks
A command with no connection of its own, for a caller that has none either — the store's own statements go through CreateCommand(DbConnection) instead.
CreateConnection()
Returns a new connection object to communicate with the database.
public DbConnection CreateConnection()
Returns
- DbConnection
A new IDbConnection
Shutdown()
Shutdowns this instance.
public void Shutdown()