Class DbMetadata
- Namespace
- Quartz.Impl.AdoJobStore.Common
- Assembly
- Quartz.dll
Metadata information about specific ADO.NET driver library. Metadata is used to create correct types of object instances to interact with the underlying database.
public sealed record DbMetadata : IEquatable<DbMetadata>
- Inheritance
-
DbMetadata
- Implements
- Inherited Members
Remarks
An init-only record: a description is built once — with an object initializer, or copied with a
with expression — and cannot drift afterwards. Everything on it is something you say about a
driver. The reflection lookups that description implies — DbBinaryTypeName resolved
against ParameterDbType, the property ParameterDbTypePropertyName
names on ParameterType, and BindByName on CommandType — are
Quartz's own, and are internal.
They replace the old two-phase Initialize() that had to be remembered. A description that
cannot work still fails where it is made rather than at the first binary parameter: every lookup
is performed once, as the metadata is registered.
Every Type here is optional, because a description only needs them when Quartz has to
construct the driver's objects — which is what DbProvider does and what a
trimmed application cannot rely on. A description handed to ProviderFactoryDbProvider or
DataSourceDbProvider gets its connections, commands and parameters from the factory or the
data source, so it names no type at all; what is left is the driver's parameter naming, and the two
typed seams below for a driver that needs a command or a binary parameter configured in a way
Quartz cannot name.
Properties
AssemblyName
Gets the name of the assembly that holds the connection library.
public string? AssemblyName { get; init; }
Property Value
- string
The name of the assembly.
BindByName
Gets a value indicating whether parameters are bind by name when using ADO.NET parameters.
public bool BindByName { get; init; }
Property Value
- bool
trueif parameters are bind by name; otherwise,false.
CommandType
Gets the type of the command.
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors|DynamicallyAccessedMemberTypes.PublicProperties)]
public Type? CommandType { get; init; }
Property Value
- Type
The type of the command.
Remarks
DbProvider constructs one of these per command it runs and, for a driver that
binds parameters by name, sets BindByName on it.
ConfigureBinaryParameter
Applied to a parameter carrying a binary column, in place of writing DbBinaryTypeName to the property ParameterDbTypePropertyName names.
public Action<DbParameter>? ConfigureBinaryParameter { get; init; }
Property Value
Remarks
The same reasoning as ConfigureCommand, for the one parameter type Quartz asks for
by name. It matters most on Oracle, where Binary means
OracleDbType.Raw and caps a job data map at two kilobytes:
parameter => ((OracleParameter) parameter).OracleDbType = OracleDbType.Blob is what an
application says instead.
Set, it wins over the reflective setter; with neither, a binary parameter is bound as plain Binary and the driver maps it.
ConfigureCommand
Applied to every command Quartz mints for this driver, in place of the reflective
BindByName probe.
public Action<DbCommand>? ConfigureCommand { get; init; }
Property Value
Remarks
Quartz sets BindByName on the managed Oracle driver's command by looking the property up
on CommandType, because it cannot name OracleCommand. A description that
names no command type — one behind a DbProviderFactory or a
DbDataSource — has nothing to look the property up on, so it
says what to do instead: command => ((OracleCommand) command).BindByName = true, in
the application, which references the driver and can name the type.
Set, it wins: the reflective probe is not attempted at all, and BindByName is left to the parameter naming it also governs.
ConnectionType
Gets the type of the connection.
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
public Type? ConnectionType { get; init; }
Property Value
- Type
The type of the connection.
Remarks
DbProvider constructs one of these per connection it opens, so the type has to keep its public constructors through trimming.
DbBinaryTypeName
Gets the type of the db binary column. This is a string representation of Enum element because this information is database driver specific.
public string? DbBinaryTypeName { get; init; }
Property Value
- string
The type of the db binary.
ExceptionType
Gets the type of the exception that is thrown when using driver library.
public Type? ExceptionType { get; init; }
Property Value
- Type
The type of the exception.
ParameterDbType
Gets the type of the database parameters.
public Type? ParameterDbType { get; init; }
Property Value
- Type
The type of the parameter db.
ParameterDbTypePropertyName
The name of the property on ParameterType that carries a parameter's database type, which DbBinaryTypeName is set through.
public string? ParameterDbTypePropertyName { get; init; }
Property Value
- string
Typically
"DbType", or the provider's own, such as"SqlDbType".
Remarks
Required exactly when DbBinaryTypeName is set, and unread otherwise — which is
why it is nullable rather than required: a provider whose parameters need no explicit
database type sets neither. Leaving it out while naming a binary type is reported at startup,
naming the database, as every other half-configured provider is.
ParameterNamePrefix
Gets the parameter name prefix.
public string? ParameterNamePrefix { get; init; }
Property Value
- string
The parameter name prefix.
ParameterType
Gets the type of the parameter.
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicProperties)]
public Type? ParameterType { get; init; }
Property Value
- Type
The type of the parameter.
Remarks
The property ParameterDbTypePropertyName names is looked up on this type.
ProductName
Gets the name of the product.
public string? ProductName { get; init; }
Property Value
- string
The name of the product.
UseParameterNamePrefixInParameterCollection
Gets a value indicating whether [use parameter name prefix in parameter collection].
public bool UseParameterNamePrefixInParameterCollection { get; init; }
Property Value
- bool
trueif [use parameter name prefix in parameter collection]; otherwise,false.
Methods
GetParameterName(string)
Gets the name of the parameter which includes the parameter prefix for this database.
public string GetParameterName(string parameterName)
Parameters
parameterNamestringName of the parameter.
Returns
Remarks
Called once per parameter bound, which is seven times for a trigger acquisition and fifteen
for a trigger write, and it was a concatenation each time. The set of names is small and
settled — the statements name about eighty-five between them, and the generated ones
(tkn000, oldState00, excludedJobType0000) are bounded by the predicate
sizes — so each spelling is worked out once and handed back thereafter.