Version

DataParameterSurrogate Class

Implementation of the IDbDataParameter interface in a data provider independent manner.
Syntax
'Declaration
 
Public Class DataParameterSurrogate 
public class DataParameterSurrogate 
Remarks

Supports instantiating the parameter collections required by queries and stored procedures before the underlying data provider technology is known.

Convertible into concrete IDbDataParameter implementations specific to an IDbCommand implementation's underlying data provider technology when required; typically the first time data binding occurs. This is done through this class' implementation of the IConvertible interface.

Developers may need to derive their own DataParameterSurrogate subclass if they must support additional databases.

Adding support for extra data parameter surrogates is simply a matter of overriding the IConvertible.ToType method in the subclass to check if the convertibleType is the IDbParameter-implementation of the .NET Data Provider for the application's database provider. When this isn't the case, the overriden method should call this base class' implementation of IConvertible.ToType. When the convertibleType does match the IDbParameter-implementation of the application's database provider, construct a new instance of the Parameter class and then invoke InitializeAdditionalProperties on it to complete it's initialization.

Developers must supply their application's custom DataParameterSurrogate subclass to their WebSchedule data provider for the custom surrogates to be used instead of the built-in ones. This is done by subclassing WebScheduleDBProviderBase (or another subclass of the Database data provider base class that has functionality needed by the application) and override it's CreateDataParameter factory method to return new instances of the custom DataParameterSurrogate subclass when the data binding infrastructure requires them.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also