예제 #1
0
        /// <summary>Executes the task.</summary>
        /// <param name="connections">The connections.</param>
        /// <param name="variableDispenser">The variables.</param>
        /// <param name="componentEvents">The event subsystem.</param>
        /// <param name="log">The logging subsystem.</param>
        /// <param name="transaction">The active transaction.</param>
        /// <returns>The results of the execution.</returns>
        /// <remarks>
        /// Derived types should not override this method.  Use <see cref="ExecuteCore"/> instead.
        /// </remarks>
        public override DTSExecResult Execute(Connections connections, VariableDispenser variableDispenser, IDTSComponentEvents componentEvents, IDTSLogging log, object transaction)
        {
            try
            {
                var context = new TaskExecuteContext()
                {
                    Connections = connections,
                    Log         = log,
                    Transaction = transaction,
                    Variables   = variableDispenser,

                    Events = componentEvents
                };

                return(ExecuteCore(context));
            } catch (Exception e)
            {
                if (componentEvents != null)
                {
                    componentEvents.LogError(b => b.Message("Unhandled exception during execution.")
                                             .Exception(e));
                }
                return(DTSExecResult.Failure);
            };
        }