Struct DefaultParamCache
Reads parameter metadata off a live IDbCommand as-is, the fallback the command uses to learn its bindings when no provider-specific reader is registered.
public struct DefaultParamCache : IDbParamInfoGetter
- Implements
- Inherited Members
- Extension Methods
Constructors
DefaultParamCache(IDbCommand)
Reads parameter metadata off a live IDbCommand as-is, the fallback the command uses to learn its bindings when no provider-specific reader is registered.
public DefaultParamCache(IDbCommand cmd)
Parameters
cmdIDbCommand
Fields
Command
The command containing the parameters
public IDbCommand Command
Field Value
Methods
EnumerateParameters()
The command's parameters, as name and position pairs, for learning them all in one pass.
public readonly IEnumerable<KeyValuePair<string, int>> EnumerateParameters()
Returns
MakeDeclaredInfo(IDbDataParameter, bool)
How a parameter binds when its metadata was declared rather than inferred, which is what the database hands back for a stored procedure's parameters.
public static DbParamInfo MakeDeclaredInfo(IDbDataParameter p, bool inputOutputHasDefault = true)
Parameters
pIDbDataParameterA parameter carrying the metadata that was declared for it.
inputOutputHasDefaultboolWhether a discovered input/output parameter may be omitted.
Returns
Remarks
A declaration is exact, so the size, or the precision and scale, are kept as stated instead of being widened the way MakeInfo(IDbDataParameter) widens a guess, and a direction other than input is carried so an output reaches the caller without being pinned by hand.
MakeInfo(IDbDataParameter)
public static DbParamInfo MakeInfo(IDbDataParameter p)
Parameters
Returns
Remarks
This reads what a provider settled on for a value it was handed, which is a guess at a shape rather than a statement of one, so the size is widened to the bucket above it and one plan serves every value of a similar length. MakeDeclaredInfo(IDbDataParameter, bool) is the counterpart for metadata that was declared rather than inferred.
MakeInfoAt(int)
The binding metadata for the parameter at position i.
public readonly DbParamInfo MakeInfoAt(int i)
Parameters
iint
Returns
TryGetInfo(string, out DbParamInfo)
Attempts to resolve a DbParamInfo for a specific parameter name by inspecting the current command's parameter collection.
public readonly bool TryGetInfo(string paramName, out DbParamInfo info)
Parameters
paramNamestringinfoDbParamInfo