Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Accesses the Variables collection during package execution. This class cannot be inherited.
public ref class VariableDispenser sealed : Microsoft::SqlServer::Dts::Runtime::DtsObject
public sealed class VariableDispenser : Microsoft.SqlServer.Dts.Runtime.DtsObject
type VariableDispenser = class inherit DtsObject
Public NotInheritable Class VariableDispenser Inherits DtsObject
There are two scenarios for using the variable dispenser.
You want several variables. In this scenario, call LockForRead and LockForWrite several times, one for each variable. This builds up two lists, one list that contains variables for reading and one list that contains variables for writing. Next, call GetVariables, which gives you a collection that contains all of the locked variables. If GetVariables succeeds, the two lists, which are the lists of variable names, not actual locks, are cleared.
To explicitly release the locks, call Unlock on the collection. This method unlocks the variables themselves. If GetVariables fails, the lists remain unchanged, and you can call GetVariables again. If you still do not succeed in obtaining the variables, call Reset to clear the lists and bring the variable dispenser back to its initial state.
The Variables collection contains a Locked property that indicates whether a variable dispenser collection of variables is locked (
true) or unlocked (
false). The reason to review this property is that some tasks explicitly release locks to the variables they are using, and calling Unlock twice throws an error. Therefore, you should use this property to determine whether the dispensed collection is locked before calling Unlock.
The VariableDispenser is used with the Runtime classes. If you are using data flow components (Microsoft.SqlServer.Dts.Pipeline), then you may be required to use the IDTSVariableDispenser100 instead. To know which variable dispenser to use, see the documentation for the object you are acquiring variables on, and verify the return object of the method.
Specifies whether an item can be retrieved from the VariableDispenser collection by using indexing without throwing an exception.
Determines whether two object instances are equal.(Inherited from DtsObject)
Returns the hash code for this instance.(Inherited from DtsObject)
Returns the qualified name of the variable.
Locks the variables that are in the read-only list and the read/write list.
Adds the variable to the list of variables to be locked for read-only access.
Adds the variable to the list of variables to be locked for read/write access.
Puts the variable in a list, and then locks it for read-only access.
Puts the variable in a list, and then locks it for read/write access.
Clears both the read-only list and read/write list when the call to GetVariables(Variables) fails.