Friday, March 9, 2012

OnVariableValueChanged event

BOL states about the OnVariableValueChanged event that it is fired by an executable, in other words not by the variable itself (http://msdn2.microsoft.com/en-us/library/ms140223.aspx)

This kind of makes sense because all events have to be fired by executables so that they can be caught by eventhandlers scoped to those executables. But it leaves me asking a few questions.

If the event is fired by an executable, is the code that fires the event part of the DTSContainer class?

How does the executable know that a variable has been changed? In other words, if I am building a custom task/component, do I have to explicitly fire the OnVariableValueChanged event if I know that the task/component I am building is going to change a variable?

Or will the SSIS runtime know that the variable has been changed.

If the answer to that last question is "yes", how does the executable know that the variable has been changed?

Is what BOL says leading me astray a little here?

Thanks in advance.

-Jamie

Jamie, the BOL topic is accurate but incomplete. The event is actually fired by the variable, but it is only visible at the container level because that is where events are surfaced. You don't have to do anything other than ensure that the FireVariableValueChanged (can't remember actual name) property is set to true.

Variables tell their container parent that they are changes via internal code paths that aren't visible to the end user. This is part of the implementation of the runtime.

Variable value is changed

Variable tells parent container

Container fires VarValChanged event

Kirk Haselden
Author "SQL Server Integration Services"

|||

Aha. Now that's interesting. So take the following scenario:

MyVariable (that has RaiseChangedEvent=TRUE) is scoped to a sequence container|||

Jamie,

Yes, that's right.

You should stop being lazy and try it.

It should work that way as well. :)

Thanks,

K

No comments:

Post a Comment