Reputation: 140
When I create a new script component within SSIS, the preexecute and post execute methods contain the base.PreExecute(); and base.PostExecute(); lines...
I want to know what these lines do, and the ramification for modifying/removing them. Thanks!
Upvotes: 0
Views: 3024
Reputation: 61231
For the current release of Integration Services, these are no-op methods. The current ramifications for removing them will be non-existent. However, Microsoft may at any time add an operation into these methods that is crucial to the well being of Integration Services (highly unlikely via patch, less so through the release of a new version). They have not done so for 2008, 2012 or 2014 but v.Next is unknown.
Unless you have a strong reason to not spend the momentary flicker hitting the base method, I'd just leave it in there.
A Script Component, creates a ScriptMain
class which is derived from UserComponent
which is derived from ScriptComponent
.
UserComponent
is auto generated by Visual Studio whenever you create/modify the inputs and outputs to a Script Component.
/* THIS IS AUTO-GENERATED CODE THAT WILL BE OVERWRITTEN! DO NOT EDIT!
* Microsoft SQL Server Integration Services component wrapper
* This module defines the base class for your component
* THIS IS AUTO-GENERATED CODE THAT WILL BE OVERWRITTEN! DO NOT EDIT! */
ScriptMain
is your playground and where you can optionally call the base.pre/postexecute methods.
Depending on your version, ScriptComponent, comes from Microsoft.SqlServer.TxScript.dll
Hitting F12 on the Pre/PostExecute component takes me to
public class ScriptComponent
{
public virtual void PostExecute();
public virtual void PreExecute();
}
I fired up ILSpy and according to it, those methods are empty
// Microsoft.SqlServer.Dts.Pipeline.ScriptComponent
public virtual void PostExecute()
{
}
// Microsoft.SqlServer.Dts.Pipeline.ScriptComponent
public virtual void PreExecute()
{
}
To refresh my memory on virtual (C# reference)
The virtual keyword is used to modify a method, property, indexer, or event declaration and allow for it to be overridden in a derived class. For example, this method can be overridden by any class that inherits it:
Upvotes: 2
Reputation: 235
I cannot really tell you exactly what the two base methods are doing, but this answer talks about the life-cycle of all SSIS task components:
All the tasks/containers in an SSIS have the same lifecycle. You can see some of this by watching the Event Handlers fire. In a script component, inside a Data Flow Task, is going to under go various steps. Part of that is Validation (this contract says I should have a column from this table that is an integer type- can I connect, does it exist, is it the right type, etc).
After validation, tasks will have setup and tear down steps to perform. Since you appear to be working with SSIS Variables in your script, part of that pre/post execute time is spent allowing the translation of Variable (SSIS) to variable (.net) and back again.
So, I would think that you should not remove them unless you have a specific requirement that SSIS's default pre- and post-processing not take place.
Upvotes: 0