/// <summary>
 /// Sets the value in Task host.
 /// </summary>
 /// <param name="taskHost">The task host.</param>
 /// <param name="configName">Name of the config.</param>
 /// <param name="value">The value.</param>
 public static void SetValue(this TaskHost taskHost, string configName, object value)
 {
     if (!String.IsNullOrEmpty(configName))
     {
         taskHost.Properties[configName].SetValue(taskHost, value);
     }
 }
Exemple #2
0
        private void ProcessDataFlow(MainPipe mainPipe, TaskHost taskHost)
        {
            foreach (IDTSComponentMetaData100 comp in mainPipe.ComponentMetaDataCollection)
            {
                string key = PackageHelper.GetComponentKey(comp);
                if (!PackageHelper.ComponentInfos.ContainsKey(key))
                {
                    System.Diagnostics.Debug.WriteLine("DataFlowPerformancePractice (170): Key not found '" + key + "'");
                    continue;
                }
                if (PackageHelper.ComponentInfos[key].Name == "OLE DB Source" ||
                    PackageHelper.ComponentInfos[key].Name == "ADO NET Source" ||
                    PackageHelper.ComponentInfos[key].Name == "Lookup")
                {
                    IDTSCustomProperty100 prop = null;
                    try
                    {
                        prop = comp.CustomPropertyCollection["AccessMode"]; //was throwing an error on some Lookup components
                    }
                    catch { }

                    if (prop != null && prop.Value is int)
                    {
                        switch ((SourceAccessMode)prop.Value)
                        {
                        case SourceAccessMode.AM_OPENROWSET:
                        case SourceAccessMode.AM_OPENROWSET_VARIABLE:
                            Results.Add(new Result(false, String.Format("Change the {0} component to use a SQL Command access mode, as this performs better than the OpenRowset access mode.", comp.Name), ResultSeverity.Normal));
                            break;
                        }
                    }
                }
            }
        }
Exemple #3
0
        public void Initialize(TaskHost taskHost, IServiceProvider serviceProvider)
        {
            _taskHost = taskHost;
            IDtsConnectionService cs = serviceProvider.GetService(typeof(IDtsConnectionService)) as IDtsConnectionService;

            _connections = cs.GetConnections();
        }
Exemple #4
0
        internal GeneralViewNode(TaskHost taskHost, IDtsConnectionService connectionService)
        {
            this.taskHost          = taskHost;
            this.connectionService = connectionService;

            // Extract common values from the Task Host
            name        = taskHost.Name;
            description = taskHost.Description;

            // Extract values from the task object
            WaitTaskMain task = taskHost.InnerObject as WaitTaskMain;

            if (task == null)
            {
                throw new ArgumentException("Type mismatch for taskHost inner object.");
            }

            AvailableConnections = LoadDBConnections();

            WaitUntilTimeInternal           = task.WaitUntilTimeInternal;
            SleepTimeInMinutes              = task.SleepTimeInMinutes;
            DoNothingAndContinue            = task.DoNothingAndContinue;
            SQLRepetitionFrequencyInMinutes = task.SQLRepetitionFrequencyInMinutes;
            SQLCheckStatement = task.SQLCheckStatement;

            SQLConnectionID = task.SQLConnectionID;
            var connection = GetConnectionById(task.SQLConnectionID);

            if (connection != null)
            {
                _sqlConnection = connection.Name;
            }

            MaximumSQLWaitTime = task.MaximumSQLWaitTime;
        }
Exemple #5
0
        private void ProcessDataFlow(MainPipe mainPipe, TaskHost taskHost)
        {
            int asyncCount = 0;

            foreach (IDTSPath100 path in mainPipe.PathCollection)
            {
                string key = PackageHelper.GetComponentKey(path.StartPoint.Component);
                if (path.StartPoint.SynchronousInputID != 0)
                {
                    continue;
                }
                if (!PackageHelper.ComponentInfos.ContainsKey(key))
                {
                    System.Diagnostics.Debug.WriteLine("DataFlowPerformancePractice (43): Key not found '" + key + "'");
                    continue;
                }
                if (PackageHelper.ComponentInfos[key].ComponentType != DTSPipelineComponentType.SourceAdapter)
                {
                    asyncCount++;
                }
            }
            //asyncCount = asyncCount - sourceCount;
            if ((asyncCount) > 0)
            {
                Results.Add(new Result(false, string.Format("There are {0} asynchronous outputs in the {1} data flow. Too many asynchronous outputs can adversely impact performance.", asyncCount, taskHost.Name), ResultSeverity.Normal));
            }
        }
Exemple #6
0
    public NuggetTaskEditor(TaskHost th)
    {
        InitializeComponent();

        this._th = th;
        this.numInterval.Value = (int)this._th.Properties["Interval"].GetValue(this._th);
    }
        public static void Main()
        {
            Forms.Application.EnableVisualStyles();
            Forms.Application.SetCompatibleTextRenderingDefault(false);

            // MSCoreXml errors here can indicate SSIS is not installed, cannot get away with just SSDT for this.
            Package    package = new Package();
            Executable exec    = package.Executables.Add("STOCK:FileSystemTask");

            TaskHost taskHost = exec as TaskHost;

            Variable variable = package.Variables.Add("MyVariable", false, "User", string.Empty);

            // Add an invalid variable expression, BIDSHelper issue 30851
            Variable variableValid = package.Variables.Add("GoodExpression", false, "User", string.Empty);

            variableValid.EvaluateAsExpression = true;
            variableValid.Expression           = "@PackageName + \" Extra\"";

            //Variable variableInvalid = package.Variables.Add("BadExpression", false, "User", string.Empty);
            //variableInvalid.EvaluateAsExpression = true;
            //variableInvalid.Expression = "@PackageNameInvalid + \" Extra\"";
            //variableInvalid.Expression = "\"Package Name: \" + @[System::PackageName] +\" was executed at: \" + (DT_WSTR, 40) @[System::StartTime] + \" by user: \" + @[System::UserName] + \" on Server Name \" + @[System::MachineName]\"";

            Forms.Application.Run(new Konesans.Dts.ExpressionEditor.ExpressionEditorPublic(package.Variables, package.VariableDispenser, taskHost.Description.GetType(), "Operation", string.Empty));

            Forms.Application.Run(new Konesans.Dts.ExpressionEditor.ExpressionEditorPublic(package.Variables, package.VariableDispenser, variable));
        }
 private void InitData(TaskHost taskHost)
 {
     this.TaskHost       = taskHost;
     this.IsScriptTask   = GetIsScriptTask(this.TaskHost);
     this.ConnectionName = this.GetTaskConnection(this.TaskHost);
     SetColumnData();
 }
        private TaskHost GetLastTaskOnSequence(Package p)
        {
            TaskHost fromTask = null;

            foreach (Executable executable in p.Executables)
            {
                if (executable is TaskHost)
                {
                    fromTask = (TaskHost)executable;

                    bool isLast = true;
                    foreach (PrecedenceConstraint precedenceConstraint in p.PrecedenceConstraints)
                    {
                        if (fromTask.Name == ((TaskHost)precedenceConstraint.PrecedenceExecutable).Name)
                        {
                            isLast = false;
                            break;
                        }
                    }
                    if (isLast)
                    {
                        break;
                    }
                }
            }
            return(fromTask);
        }
        public static List <TaskHost> GetControlFlowObjects <T>(DtsContainer container)
        {
            List <TaskHost> returnItems = new List <TaskHost>();

            if (container is EventsProvider)
            {
                EventsProvider ep = (EventsProvider)container;

                foreach (DtsEventHandler eh in ep.EventHandlers)
                {
                    returnItems.AddRange(GetControlFlowObjects <T>(eh));
                }
            }

            IDTSSequence sequence = (IDTSSequence)container;

            foreach (Executable exec in sequence.Executables)
            {
                if (exec is IDTSSequence)
                {
                    returnItems.AddRange(GetControlFlowObjects <T>((DtsContainer)exec));
                }
                else if (exec is TaskHost)
                {
                    TaskHost th = (TaskHost)exec;
                    if (th.InnerObject is T)
                    {
                        returnItems.Add(th);
                    }
                }
            }

            return(returnItems);
        }
Exemple #11
0
 public void Initialize(TaskHost taskHost, IServiceProvider serviceProvider)
 {
     this.taskHost = taskHost;
       this.serviceProvider = serviceProvider;
       IDtsConnectionService connectionService = serviceProvider.GetService(typeof(IDtsConnectionService)) as IDtsConnectionService;
       this.connections = connectionService.GetConnections();
 }
        public override void ConstructComponent()
        {
            var executableInstance = Container.Executables.Add(ComponentType);

            Executable = executableInstance as IDTSObjectHost;

            SqlCommandTaskHost = executableInstance as TaskHost;

            if (SqlCommandTaskHost == null)
            {
                throw new SsisScripterException(
                          string.Format("Cannot cast the components executable to: {1}\nReal type is {0}",
                                        executableInstance == null ? "NULL" : executableInstance.GetType().AssemblyQualifiedName, typeof(TaskHost).AssemblyQualifiedName));
            }

            SqlCommandTaskHost.Name = Name;

            var executeSqlTask = SqlCommandTaskHost.InnerObject as ExecuteSQLTask;

            if (executeSqlTask == null)
            {
                throw new SsisScripterException(
                          string.Format("Cannot cast the components executable to: {1}\nReal type is {0}",
                                        SqlCommandTaskHost.InnerObject == null ? "NULL" : SqlCommandTaskHost.InnerObject.GetType().AssemblyQualifiedName,
                                        typeof(ExecuteSQLTask).AssemblyQualifiedName));
            }
            executeSqlTask.Connection        = _connectionManager.Name;
            executeSqlTask.IsStoredProcedure = _isStoredProcedure;
        }
Exemple #13
0
        public frmEmail(TaskHost taskHost, Connections connections)
        {
            InitializeComponent();
            _taskHost   = taskHost;
            Connections = connections;
            LoadSMTPConnections();
            LoadVariablesInComboBoxes();
            LoadKeysComboBox();

            cmbFrom.Text = (_taskHost.Properties[Keys.FROM].GetValue(_taskHost) != null)
                                ? _taskHost.Properties[Keys.FROM].GetValue(_taskHost).ToString()
                                : string.Empty;
            cmbTo.Text = (_taskHost.Properties[Keys.FROM].GetValue(_taskHost) != null)
                                ? _taskHost.Properties[Keys.RECIPIENTS].GetValue(_taskHost).ToString()
                                : string.Empty;
            txSubject.Text = (_taskHost.Properties[Keys.FROM].GetValue(_taskHost) != null)
                                ? _taskHost.Properties[Keys.EMAIL_SUBJECT].GetValue(_taskHost).ToString()
                                : string.Empty;
            txBody.Text = (_taskHost.Properties[Keys.FROM].GetValue(_taskHost) != null)
                                ? _taskHost.Properties[Keys.EMAIL_BODY].GetValue(_taskHost).ToString()
                                : string.Empty;
            if (_taskHost.Properties[Keys.FROM].GetValue(_taskHost) != null)
            {
                cmbSMTPSrv.SelectedIndex = Tools.FindStringInComboBox(cmbSMTPSrv, _taskHost.Properties[Keys.SMTP_SERVER].GetValue(_taskHost).ToString(), -1);
            }
        }
        private string CheckTaskHost(TaskHost taskHost, BackgroundWorker worker, string path, DtsContainer container, string containerKey)
        {
            string objectTypeName = taskHost.InnerObject.GetType().Name;

            // Task specific checks, split by native and managed
            if (objectTypeName == "__ComObject")
            {
                // Native code tasks, can't use type name, so use creation name.
                // Need to be wary of suffix, SSIS.ExecutePackageTask.3 for 2012, SSIS.ExecutePackageTask.4 for 2014 etc
                if (taskHost.CreationName == string.Format("SSIS.ExecutePackageTask.{0}", SSISHelpers.CreationNameIndex))
                {
                    objectTypeName = "ExecutePackageTask";
                }
                else if (taskHost.CreationName == string.Format("SSIS.Pipeline.{0}", SSISHelpers.CreationNameIndex))
                {
                    objectTypeName = "DataFlowTask";
                }
                else
                {
                    objectTypeName = "**UnknownNativeTask**";
                }
            }

            ScanProperties(worker, path, typeof(TaskHost), objectTypeName, container.ID, container.ID, container.Name, taskHost, containerKey);

            return(objectTypeName);
        }
        public ExecutableNodeFactory(Executable executable,Executables collection)
        {
            _collection = collection;
            _executable = (DtsContainer)executable;
            _host = _executable as TaskHost;
            _seq = _executable as Sequence;
            _foreachloop = _executable as ForEachLoop;
            _forloop = _executable as ForLoop;
            _psExecutable = PSObject.AsPSObject(_executable);

            if (null != _host)
            {
                _psExecutable.Properties.Add( new PSNoteProperty( "IsTaskHost", true ));
                _mainPipe = _host.InnerObject as MainPipe;
            }
            if (null != _mainPipe)
            {
                _psExecutable.Properties.Add(new PSNoteProperty("IsDataFlow", true));
            }
            if (null != _seq)
            {
                _psExecutable.Properties.Add(new PSNoteProperty("IsSequence", true));
            }
            if (null != _foreachloop)
            {
                _psExecutable.Properties.Add(new PSNoteProperty("IsForEachLoop", true));
            }
            if (null != _forloop)
            {
                _psExecutable.Properties.Add(new PSNoteProperty("IsForLoop", true));
            }
        }
 private void RecurseComponentsAndBuildPerformanceObjects(IDTSSequence container, DtsObjectPerformance performance, int indent)
 {
     foreach (Executable exe in container.Executables)
     {
         if (exe is DtsContainer)
         {
             DtsContainer child = (DtsContainer)exe;
             DtsObjectPerformance childPerformance;
             if (exe is TaskHost)
             {
                 TaskHost task = (TaskHost)exe;
                 MainPipe pipeline = task.InnerObject as MainPipe;
                 if (pipeline != null)
                 {
                     childPerformance = new DtsPipelinePerformance(child.ID, child.Name, pipeline, indent + 1);
                 }
                 else
                 {
                     childPerformance = new DtsObjectPerformance(child.ID, child.Name, child.GetType(), indent + 1);
                 }
                 listComponentsPerformanceLookup.Add(child.ID, childPerformance);
             }
             else
             {
                 childPerformance = new DtsObjectPerformance(child.ID, child.Name, child.GetType(), indent + 1);
                 listComponentsPerformanceLookup.Add(child.ID, childPerformance);
             }
             performance.Children.Add(childPerformance);
             if (exe is IDTSSequence)
             {
                 RecurseComponentsAndBuildPerformanceObjects((IDTSSequence)exe, childPerformance, indent + 1);
             }
         }
     }
 }
Exemple #17
0
        public IDTSParameterBinding Modify_ExecSQL_AddParameterBinding(
            Executable ex,
            string BingingVariableName,
            OleDBDataTypes BingingDataType
            )
        {
            TaskHost       SQLth = (TaskHost)ex;
            ExecuteSQLTask task  = SQLth.InnerObject as ExecuteSQLTask;

            int i = 0;

            foreach (IDTSParameterBinding z in task.ParameterBindings)
            {
                i++;
            }

            task.ParameterBindings.Add();
            IDTSParameterBinding pb = task.ParameterBindings.GetBinding(i);

            pb.DtsVariableName    = BingingVariableName;
            pb.ParameterDirection = ParameterDirections.Input;
            pb.DataType           = (int)BingingDataType;
            pb.ParameterName      = i;
            pb.ParameterSize      = -1;

            return(pb);
        }
Exemple #18
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="taskHost"></param>
 /// <param name="connections"></param>
 public ReportGeneratorUi(TaskHost taskHost, Connections connections)
 {
     InitializeComponent();
     _taskHost         = taskHost;
     Connections       = connections;
     _renderExtensions = new RenderExtensions();
 }
Exemple #19
0
        private void ProcessDataFlow(MainPipe mainPipe, TaskHost taskHost)
        {
            int sortCount = 0;

            foreach (IDTSComponentMetaData100 comp in mainPipe.ComponentMetaDataCollection)
            {
                string key = PackageHelper.GetComponentKey(comp);
                if (!PackageHelper.ComponentInfos.ContainsKey(key))
                {
                    System.Diagnostics.Debug.WriteLine("DataFlowPerformancePractice ProcessDataFlow(113): Key not found '" + key + "'");
                    continue;
                }
                if (PackageHelper.ComponentInfos[key].CreationName == "DTSTransform.Sort.2")
                {
                    sortCount++;
                    //Trace the input
                    IDTSComponentMetaData100 sourceComp = PackageHelper.TraceInputToSource(mainPipe, comp);


                    if (sourceComp != null)
                    {
                        key = PackageHelper.GetComponentKey(sourceComp);
                        if (PackageHelper.ComponentInfos[key].Name == "OLE DB Source" ||
                            PackageHelper.ComponentInfos[key].Name == "ADO NET Source")
                        {
                            Results.Add(new Result(false, string.Format("The {0} Sort transformation is operating on data provided from the {1} source. Rather than using the Sort transformation, which is fully blocking, the sorting should be performed using a WHERE clause in the source's SQL, and the IsSorted and SortKey properties should be set appropriately. Reference: http://msdn.microsoft.com/en-us/library/ms137653(SQL.90).aspx", comp.Name, sourceComp.Name), ResultSeverity.Normal));
                        }
                    }
                }
            }
            if (sortCount > 2)
            {
                Results.Add(new Result(false, String.Format("There are {0} Sort transfomations in the {1} data flow. A large number of Sorts can slow down data flow performance. Consider staging the data to a relational database and sorting it there.", sortCount, taskHost.Name), ResultSeverity.Normal));
            }
        }
    public NuggetTaskEditor(TaskHost th)
    {
        InitializeComponent();

        this._th = th;
        this.numInterval.Value = (int)this._th.Properties["Interval"].GetValue(this._th);
    }
Exemple #21
0
        /// <summary>Called to initialize the UI.</summary>
        /// <param name="taskHost">The task host.</param>
        /// <param name="serviceProvider">The service provider.</param>
        public void Initialize(TaskHost taskHost, IServiceProvider serviceProvider)
        {
            Host            = taskHost;
            ServiceProvider = serviceProvider;

            InitializeCore();
        }
        public frmEditProperties(TaskHost taskHost)
        {
            InitializeComponent();

            _taskHost = taskHost;

            if (taskHost == null)
            {
                throw new ArgumentNullException("taskHost");
            }

            _variables = taskHost.Variables;

            try
            {
                InitializeForm();
                if (_taskHost.Properties[Keys.PowerShellScript].GetValue(_taskHost) != null)
                {
                    textBoxScript.Text = _taskHost.Properties[Keys.PowerShellScript].GetValue(_taskHost).ToString();
                }

                if (_taskHost.Properties[Keys.OutputVariableName].GetValue(_taskHost) != null)
                {
                    cmbOut.SelectedIndex = GetSelectedComboBoxIndex(cmbOut, _taskHost.Properties[Keys.OutputVariableName].GetValue(_taskHost));
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
            }
        }
        private void SaveTaskHost(TaskHost taskHost)
        {
            SaveFileDialog file = new SaveFileDialog();

            file.RestoreDirectory = true;
            file.InitialDirectory = System.IO.Path.GetDirectoryName(txtSsisPackageFile.Text);
            file.Filter           = "Sql Script (*.sql)|*.sql";
            file.FileName         = package.Name + " - " + taskHost.Name;

            if (SaveFileToNearCheckBox.Checked || file.ShowDialog() == DialogResult.OK)
            {
                string sqlStatementSource = GetSqlStatementSource(taskHost);

                if (sqlStatementSource == null)
                {
                    return;
                }

                string selectedFile;
                if (SaveFileToNearCheckBox.Checked)
                {
                    selectedFile = Path.Combine(file.InitialDirectory, file.FileName + ".sql");
                }
                else
                {
                    selectedFile = file.FileName;
                }

                System.IO.File.WriteAllText(selectedFile, sqlStatementSource);
            }
        }
        public void OnCommit(object taskHost)
        {
            TaskHost host = taskHost as TaskHost;

            if (host == null)
            {
                throw new ArgumentException("Arugment is not a TaskHost.", "taskHost");
            }

            WaitTaskMain task = host.InnerObject as WaitTaskMain;

            if (task == null)
            {
                throw new ArgumentException("Arugment is not a A.LE WaitTask.", "taskHost");
            }

            host.Name        = generalNode.Name;
            host.Description = generalNode.Description;

            // Task properties
            task.WaitUntilTimeInternal           = generalNode.WaitUntilTimeInternal;
            task.SleepTimeInMinutes              = generalNode.SleepTimeInMinutes;
            task.DoNothingAndContinue            = generalNode.DoNothingAndContinue;
            task.SQLRepetitionFrequencyInMinutes = generalNode.SQLRepetitionFrequencyInMinutes;
            task.SQLCheckStatement  = generalNode.SQLCheckStatement;
            task.SQLConnectionID    = generalNode.SQLConnectionID;
            task.MaximumSQLWaitTime = generalNode.MaximumSQLWaitTime;
        }
        private string GetSqlStatementSource(TaskHost task)
        {
            if (task == null)
            {
                return(null);
            }

            foreach (var p in task.Properties)
            {
                if (p.Name == "SqlStatementSource")
                {
                    try
                    {
                        return((string)p.GetValue(task));
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                        return(null);
                    }
                }
            }

            return(null);
        }
Exemple #26
0
 void IDTSEvents.OnTaskFailed(TaskHost taskHost)
 {
     LogDtsEvent(
         LogEventLevel.Error,
         "taskHost:{@taskHost}",
         new object[] { taskHost });
 }
Exemple #27
0
 public CachedHighlightStatus(Package package, TaskHost taskHost, bool bHasExpression, bool bHasConfiguration)
 {
     this.package           = package;
     this.taskHost          = taskHost;
     this.bHasExpression    = bHasExpression;
     this.bHasConfiguration = bHasConfiguration;
 }
Exemple #28
0
        public ExecutableNodeFactory(Executable executable, Executables collection)
        {
            _collection   = collection;
            _executable   = (DtsContainer)executable;
            _host         = _executable as TaskHost;
            _seq          = _executable as Sequence;
            _foreachloop  = _executable as ForEachLoop;
            _forloop      = _executable as ForLoop;
            _psExecutable = PSObject.AsPSObject(_executable);

            if (null != _host)
            {
                _psExecutable.Properties.Add(new PSNoteProperty("IsTaskHost", true));
                _mainPipe = _host.InnerObject as MainPipe;
            }
            if (null != _mainPipe)
            {
                _psExecutable.Properties.Add(new PSNoteProperty("IsDataFlow", true));
            }
            if (null != _seq)
            {
                _psExecutable.Properties.Add(new PSNoteProperty("IsSequence", true));
            }
            if (null != _foreachloop)
            {
                _psExecutable.Properties.Add(new PSNoteProperty("IsForEachLoop", true));
            }
            if (null != _forloop)
            {
                _psExecutable.Properties.Add(new PSNoteProperty("IsForLoop", true));
            }
        }
        private void CheckExecuteSQLTask(TaskHost taskHost, TreeNode parent)
        {
            ExecuteSQLTask task = taskHost.InnerObject as ExecuteSQLTask;

            TreeNode parameterBindings = AddFolder("ParameterBindings", parent);

            foreach (IDTSParameterBinding binding in task.ParameterBindings)
            {
                string match;
                string value = binding.DtsVariableName;
                if (!string.IsNullOrEmpty(value) && PropertyMatchEval(value, out match))
                {
                    VariableFoundEventArgs info = new VariableFoundEventArgs();
                    info.Match = match;
                    OnRaiseVariableFound(info);
                    AddNode(parameterBindings, binding.ParameterName.ToString(), GetImageIndex(IconKeyProperty), binding, true);
                }
            }

            TreeNode resultSetBindings = AddFolder("ResultSetBindings", parent);

            foreach (IDTSResultBinding binding in task.ResultSetBindings)
            {
                string match;
                string value = binding.DtsVariableName;
                if (!string.IsNullOrEmpty(value) && PropertyMatchEval(value, out match))
                {
                    VariableFoundEventArgs info = new VariableFoundEventArgs();
                    info.Match = match;
                    OnRaiseVariableFound(info);
                    AddNode(resultSetBindings, binding.ResultName.ToString(), GetImageIndex(IconKeyProperty), binding, true);
                }
            }
        }
Exemple #30
0
        /// <summary>
        /// Set up and initialize before each test is run
        /// </summary>
        public TaskHost_Tests()
        {
            LoggingServiceFactory loggingFactory = new LoggingServiceFactory(LoggerMode.Synchronous, 1);

            _loggingService = loggingFactory.CreateInstance(BuildComponentType.LoggingService) as LoggingService;

            _customLogger            = new MyCustomLogger();
            _mockHost                = new MockHost();
            _mockHost.LoggingService = _loggingService;

            _loggingService.RegisterLogger(_customLogger);
            _elementLocation = ElementLocation.Create("MockFile", 5, 5);

            BuildRequest buildRequest = new BuildRequest(1 /* submissionId */, 1, 1, new List <string>(), null, BuildEventContext.Invalid, null);
            BuildRequestConfiguration configuration = new BuildRequestConfiguration(1, new BuildRequestData("Nothing", new Dictionary <string, string>(), "4.0", new string[0], null), "2.0");

            configuration.Project = new ProjectInstance(ProjectRootElement.Create());

            BuildRequestEntry entry = new BuildRequestEntry(buildRequest, configuration);

            BuildResult buildResult = new BuildResult(buildRequest, false);

            buildResult.AddResultsForTarget("Build", new TargetResult(new TaskItem[] { new TaskItem("IamSuper", configuration.ProjectFullPath) }, TestUtilities.GetSkippedResult()));
            _mockRequestCallback = new MockIRequestBuilderCallback(new BuildResult[] { buildResult });
            entry.Builder        = (IRequestBuilder)_mockRequestCallback;

            _taskHost = new TaskHost(_mockHost, entry, _elementLocation, null /*Don't care about the callback either unless doing a build*/);
            _taskHost.LoggingContext = new TaskLoggingContext(_loggingService, BuildEventContext.Invalid);
        }
        public Executable AddTask_ExecPackage(string TaskName,
                                              string PackageName,
                                              Sequence sqp = null
                                              )
        {
            Executable ex = null;

            if (sqp == null)
            {
                ex = p.Executables.Add("Microsoft.ExecutePackageTask");
            }
            else
            {
                ex = sqp.Executables.Add("Microsoft.ExecutePackageTask");
            }

            TaskHost SQLth = (TaskHost)ex;

            DtsProperty dt_name = SQLth.Properties["Name"];
            DtsProperty dt_pnam = SQLth.Properties["PackageName"];
            DtsProperty dt_uref = SQLth.Properties["UseProjectReference"];

            dt_name.SetValue(SQLth, TaskName);
            dt_pnam.SetValue(SQLth, PackageName);
            dt_uref.SetValue(SQLth, true);

            return(ex);
        }
        private void AddDataFlowTaskInfo(string packageFile, string taskHostName, TaskHost taskHost, string containerName = null)
        {
            foreach (IDTSComponentMetaData100 item in ((MainPipe)taskHost.InnerObject).ComponentMetaDataCollection)
            {
                List <string> taskContent = new List <string>();

                if (containerName != null)
                {
                    taskContent.Add(containerName);
                }

                taskContent.Add(packageFile);
                taskContent.Add(taskHost.Description + H_TAB + taskHostName);      // taskHostName == object name
                taskContent.Add(item.Description + H_TAB + item.Name);             // item.Name == component name

                // Reference: "How to use LINQ with dynamic collections" (http://stackoverflow.com/questions/18734996/how-to-use-linq-with-dynamic-collections)
                if (item.CustomPropertyCollection.Cast <dynamic>().ToDictionary(x => x.Name).ContainsKey(OPEN_ROWSET) && !String.IsNullOrWhiteSpace(item.CustomPropertyCollection[OPEN_ROWSET].Value))
                {
                    taskContent.Add(OPEN_ROWSET + H_TAB + item.CustomPropertyCollection[OPEN_ROWSET].Value);
                }

                if (item.CustomPropertyCollection.Cast <dynamic>().ToDictionary(x => x.Name).ContainsKey(SQL_COMMAND) && !String.IsNullOrWhiteSpace(item.CustomPropertyCollection[SQL_COMMAND].Value))
                {
                    taskContent.Add(SQL_COMMAND + H_TAB + item.CustomPropertyCollection[SQL_COMMAND].Value);
                }

                taskContent.Add(NEW_LINE);
                _allResults.Add(_taskCounter.ToString(), taskContent);
                _taskCounter++;
            }
        }
 public void Play(QueueItem item, int?queueIndex)
 {
     Assert.IsTrue(TaskHost.GetPlayRequestedReset(), "Play requested");
     CheckBeforePlayNextSong(item, queueIndex);
     TaskHost.Play();
     Assert.IsTrue(Manager.IsPlaying, "Is playing");
     CheckAfterPlayStarted(item, queueIndex);
 }
        public frmLogUI(TaskHost taskHost)
        {
            _taskHost = taskHost;

            InitializeComponent();
            this.Text += " " + Version;

            PopulateComponentTypeComboBox();
            PopulateVariablesComboBox();
            InitValues();
        }
 public HelloWorldTaskUIMainWnd(TaskHost taskHost, object connections) :
     base(Title, TaskIcon, Description, taskHost, connections)
 {
     InitializeComponent();
     
     // Setup our views
     generalView = new GeneralView();
     this.DTSTaskUIHost.FastLoad = false;
     this.DTSTaskUIHost.AddView("General", generalView, null);
     this.DTSTaskUIHost.FastLoad = true;
 }
        public ExecuteAzureMLBatchUIMainWnd(TaskHost taskHost, IServiceProvider serviceProvider, object connections) :
            base(Title, TaskIcon, Description, taskHost, connections)
        {            
            InitializeComponent();

            this.serviceProvider = serviceProvider;

            // Setup our views
            _generalView = new ExecuteAzureMLBatchGeneralView();

            this.DTSTaskUIHost.FastLoad = false;
            this.DTSTaskUIHost.AddView("General", _generalView, null);
            this.DTSTaskUIHost.FastLoad = true;
        }
        public SSHFTPTaskUIForm(TaskHost taskHostValue, IServiceProvider serviceProvider)
        {
            _taskHostValue = taskHostValue;
            _serviceProvider = serviceProvider;
            InitializeComponent();
            if (_taskHostValue.Properties["SSHConnMgrName"].GetValue(_taskHostValue) != null)
            {
                _SSHconnMgrName = _taskHostValue.Properties["SSHConnMgrName"].GetValue(_taskHostValue).ToString();
            }
            if (_taskHostValue.Properties["SendFilesSourceConnectionManagerName"].GetValue(_taskHostValue) != null)
            {
                _sendFilesSourceConnectionManagerName = _taskHostValue.Properties["SendFilesSourceConnectionManagerName"].GetValue(_taskHostValue).ToString();
            }
            if (_taskHostValue.Properties["SendFilesDestinationDirectory"].GetValue(_taskHostValue) != null)
            {
                SendFilesDestinationdirectorytextBox.Text = _taskHostValue.Properties["SendFilesDestinationDirectory"].GetValue(_taskHostValue).ToString();
            }
            if (_taskHostValue.Properties["ReceiveFilesDestinationConnectionManagerName"].GetValue(_taskHostValue) != null)
            {
                _receiveFilesDestinationConnectionManagerName = _taskHostValue.Properties["ReceiveFilesDestinationConnectionManagerName"].GetValue(_taskHostValue).ToString();
            }
            if (_taskHostValue.Properties["ReceiveFilesSourceFile"].GetValue(_taskHostValue) != null)
            {
                 ReceiveFilesSourceFiletextBox.Text = _taskHostValue.Properties["ReceiveFilesSourceFile"].GetValue(_taskHostValue).ToString();
            }
            if (_taskHostValue.Properties["Operation"].GetValue(_taskHostValue) != null)
            {
                if ((SSHFTPOperation)_taskHostValue.Properties["Operation"].GetValue(_taskHostValue) == SSHFTPOperation.SendFiles)
                {
                    OperationTypecomboBox.SelectedIndex = 0;
                }
                if ((SSHFTPOperation)_taskHostValue.Properties["Operation"].GetValue(_taskHostValue) == SSHFTPOperation.ReceiveFiles)
                {
                    OperationTypecomboBox.SelectedIndex = 1;
                }
            }
            setPanels(OperationTypecomboBox);

            IDtsConnectionService dtsConnectionService =
                    (IDtsConnectionService)serviceProvider.GetService(typeof(IDtsConnectionService));
            _dtsConnectionService = dtsConnectionService;
            //OperationTypecomboBox.SelectedIndex = 0;
            PopulateConnectionsCombo(SSHConnectioncomboBox, "SSH", _SSHconnMgrName, null);
            PopulateConnectionsCombo(SendFilesSourceConnectioncomboBox, "FILE",
                _sendFilesSourceConnectionManagerName, DTSFileConnectionUsageType.FileExists);
            PopulateConnectionsCombo(DestinationConnectioncomboBox, "FILE",
                _receiveFilesDestinationConnectionManagerName, DTSFileConnectionUsageType.FolderExists);
        }
            internal GeneralViewNode(TaskHost taskHost, IDtsConnectionService connectionService)
            {
                // Extract common values from the Task Host
                name = taskHost.Name;
                description = taskHost.Description;

                // Extract values from the task object
                HelloWorldTask task = taskHost.InnerObject as HelloWorldTask;
                if (task == null)
                {
                    string msg = string.Format(CultureInfo.CurrentCulture, "Type mismatch for taskHost inner object. Received: {0} Expected: {1}", taskHost.InnerObject.GetType().Name, typeof(HelloWorldTask).Name);
                    throw new ArgumentException(msg);
                }

                displayText = task.DisplayText;
            }
 private void ProcessDataFlow(MainPipe mainPipe, TaskHost taskHost)
 {
     int asyncCount = 0;
     foreach (IDTSPath100 path in mainPipe.PathCollection)
     {
         string key = PackageHelper.GetComponentKey(path.StartPoint.Component);
         if (path.StartPoint.SynchronousInputID != 0)
         {
             continue;
         }
         if (PackageHelper.ComponentInfos[key].ComponentType != DTSPipelineComponentType.SourceAdapter)
         {
             asyncCount++;
         }
     }
     //asyncCount = asyncCount - sourceCount;
     if ((asyncCount) > 0)
     {
         Results.Add(new Result(false, string.Format("There are {0} asynchronous outputs in the {1} data flow. Too many asynchronous outputs can adversely impact performance.", asyncCount, taskHost.Name), ResultSeverity.Normal));
     }
 }
        public SSHExecuteCommandTaskUIForm(TaskHost taskHostValue, IServiceProvider serviceProvider)
        {
            _taskHostValue = taskHostValue;
            _serviceProvider = serviceProvider;
            InitializeComponent();
            if (_taskHostValue.Properties["CommandText"].GetValue(_taskHostValue) != null)
            {
                _commandText = _taskHostValue.Properties["CommandText"].GetValue(_taskHostValue).ToString();
            }
            //ConnMgrName
            if (_taskHostValue.Properties["ConnMgrName"].GetValue(_taskHostValue) != null)
            {
                _connMgrName = _taskHostValue.Properties["ConnMgrName"].GetValue(_taskHostValue).ToString();
            }

            IDtsConnectionService dtsConnectionService =
                    (IDtsConnectionService)serviceProvider.GetService(typeof(IDtsConnectionService));
            _dtsConnectionService = dtsConnectionService;

            PopulateConnectionsCombo(ConnectionManagercomboBox, "SSH", _connMgrName);
        }
        private void AddDataFlowTaskInfo(string packageFile, string taskHostName, TaskHost taskHost, string containerName = null) {
            foreach(IDTSComponentMetaData100 item in ((MainPipe)taskHost.InnerObject).ComponentMetaDataCollection) {
                List<string> taskContent = new List<string>();

                if(containerName != null) {
                    taskContent.Add(containerName);
                }

                taskContent.Add(packageFile);
                taskContent.Add(taskHost.Description + H_TAB + taskHostName);      // taskHostName == object name
                taskContent.Add(item.Description + H_TAB + item.Name);             // item.Name == component name

                // Reference: "How to use LINQ with dynamic collections" (http://stackoverflow.com/questions/18734996/how-to-use-linq-with-dynamic-collections)
                if(item.CustomPropertyCollection.Cast<dynamic>().ToDictionary(x => x.Name).ContainsKey(OPEN_ROWSET) && !String.IsNullOrWhiteSpace(item.CustomPropertyCollection[OPEN_ROWSET].Value)) {
                    taskContent.Add(OPEN_ROWSET + H_TAB + item.CustomPropertyCollection[OPEN_ROWSET].Value);
                }

                if(item.CustomPropertyCollection.Cast<dynamic>().ToDictionary(x => x.Name).ContainsKey(SQL_COMMAND) && !String.IsNullOrWhiteSpace(item.CustomPropertyCollection[SQL_COMMAND].Value)) {
                    taskContent.Add(SQL_COMMAND + H_TAB + item.CustomPropertyCollection[SQL_COMMAND].Value);
                }

                taskContent.Add(NEW_LINE);
                _allResults.Add(_taskCounter.ToString(), taskContent);
                _taskCounter++;
            }
        }
Exemple #42
0
 public void OnProgress(TaskHost taskHost, string progressDescription, int percentComplete, int progressCountLow, int progressCountHigh, string subComponent, ref bool fireAgain)
 {
     _builder.AppendLine(String.Format(
                         "[{2}] PROGRESS: [{0}]% [{1}]", percentComplete, subComponent, DateTime.Now.ToLongTimeString()
                         ));
 }
 public EzExecuteSQLTask(EzContainer parent, TaskHost task)
     : base(parent, task)
 {
 }
        private void ProcessDataFlow(MainPipe mainPipe, TaskHost taskHost)
        {
            int sortCount = 0;
            foreach (IDTSComponentMetaData100 comp in mainPipe.ComponentMetaDataCollection)
            {
                string key = PackageHelper.GetComponentKey(comp);

                if (PackageHelper.ComponentInfos[key].CreationName == "DTSTransform.Sort.2")
                {
                    sortCount++;
                    //Trace the input
                    IDTSComponentMetaData100 sourceComp = PackageHelper.TraceInputToSource(mainPipe, comp);


                    if (sourceComp != null)
                    {
                        key = PackageHelper.GetComponentKey(sourceComp);
                        if (PackageHelper.ComponentInfos[key].Name == "OLE DB Source" ||
                            PackageHelper.ComponentInfos[key].Name == "ADO NET Source")
                        {
                            Results.Add(new Result(false, string.Format("The {0} Sort transformation is operating on data provided from the {1} source. Rather than using the Sort transformation, which is fully blocking, the sorting should be performed using a WHERE clause in the source's SQL, and the IsSorted and SortKey properties should be set appropriately. Reference: http://msdn.microsoft.com/en-us/library/ms137653(SQL.90).aspx", comp.Name, sourceComp.Name), ResultSeverity.Normal));
                        }
                    }
                }
            }
            if (sortCount > 2)
            {
                Results.Add(new Result(false, String.Format("There are {0} Sort transfomations in the {1} data flow. A large number of Sorts can slow down data flow performance. Consider staging the data to a relational database and sorting it there.", sortCount, taskHost.Name), ResultSeverity.Normal));
            }
        }
 public void Initialize(TaskHost taskHost, IServiceProvider serviceProvider)
 {
     _taskHostValue = taskHost;
     _serviceprovider = serviceProvider;
     frm = new SSHExecuteCommandTaskUIForm(_taskHostValue, _serviceprovider);
 }
        private void ProcessDataFlow(MainPipe mainPipe, TaskHost taskHost)
        {
            foreach (IDTSComponentMetaData100 comp in mainPipe.ComponentMetaDataCollection)
            {
                string key = PackageHelper.GetComponentKey(comp);

                if (PackageHelper.ComponentInfos[key].Name == "OLE DB Source" ||
                    PackageHelper.ComponentInfos[key].Name == "ADO NET Source" ||
                    PackageHelper.ComponentInfos[key].Name == "Lookup")
                {
                    IDTSCustomProperty100 prop = null;
                    try
                    {
                        prop = comp.CustomPropertyCollection["AccessMode"]; //was throwing an error on some Lookup components
                    }
                    catch { }

                    if (prop != null && prop.Value is int)
                    {
                        switch ((SourceAccessMode)prop.Value)
                        {
                            case SourceAccessMode.AM_OPENROWSET:
                            case SourceAccessMode.AM_OPENROWSET_VARIABLE:
                                Results.Add(new Result(false, String.Format("Change the {0} component to use a SQL Command access mode, as this performs better than the OpenRowset access mode.", comp.Name), ResultSeverity.Normal));
                                break;
                        }
                    }
                }
            }
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="taskHost"></param>
 /// <param name="progressDescription"></param>
 /// <param name="percentComplete"></param>
 /// <param name="progressCountLow"></param>
 /// <param name="progressCountHigh"></param>
 /// <param name="subComponent"></param>
 /// <param name="fireAgain"></param>
 public override void OnProgress(TaskHost taskHost, string progressDescription, int percentComplete, int progressCountLow, int progressCountHigh, string subComponent, ref bool fireAgain)
 {
     string inCadena = subComponent;
     errores.Add(progressDescription);
     parentWin.addText(progressDescription+"\n");
 }
Exemple #48
0
 public void Initialize(TaskHost taskHost, IServiceProvider serviceProvider)
 {
     _taskHost = taskHost;           
 }
            internal GeneralViewNode(TaskHost taskHost, IDtsConnectionService connectionService)
            {
                this.iDtsConnection = connectionService;
                this.myTaskHost = taskHost;
                this._variableService = this.myTaskHost.Site.GetService(typeof (IDtsVariableService)) as IDtsVariableService;

                // Extract common values from the Task Host
                name = taskHost.Name;
                description = taskHost.Description;

                // Extract values from the task object
                ExecuteAzureMLBatch task = taskHost.InnerObject as ExecuteAzureMLBatch;
                if (task == null)
                {
                    string msg = string.Format(CultureInfo.CurrentCulture, "Type mismatch for taskHost inner object. Received: {0} Expected: {1}", taskHost.InnerObject.GetType().Name, typeof(ExecuteAzureMLBatch).Name);
                    throw new ArgumentException(msg);
                }

                connection = task.Connection;
                azureMLUrl = task.AzureMLBaseURL;
                azureMLKey = task.AzureMLAPIKey;
                blobName = task.BlobName;
                sourceType = task.InputSource;                
                destinationType = task.OutputDestination;

                switch (sourceType)
                {
                    case (SourceType.BlobPath):
                        sourceBlobPath = task.Source;
                        break;
                    case (SourceType.DirectInput):
                        sourceDirect = task.Source;
                        break;
                    case (SourceType.FileConnection):
                        source = task.Source;
                        break;
                    case (SourceType.Variable):
                        sourceVariable = task.Source;
                        break;
                    default:
                        break;
                }

                switch (destinationType)
                {
                    case (DestinationType.FileConnection):
                        destination = task.Destination;
                        break;
                    case (DestinationType.Variable):
                        destinationVariable = task.Destination;
                        break;
                    default:
                        break;
                }
            }
Exemple #50
0
		public void OnCustomEvent(TaskHost taskHost, string eventName, string eventText, ref object[] arguments, string subComponent, ref bool fireAgain)
		{
		}
Exemple #51
0
 public void Initialize(TaskHost taskHost, IServiceProvider serviceProvider)
 {
     this._th = taskHost;
 }
Exemple #52
0
		public void OnProgress(TaskHost taskHost, string progressDescription, int percentComplete, int progressCountLow, int progressCountHigh, string subComponent, ref bool fireAgain)
		{
			Console.WriteLine("[Progress] {0}: {1} = {2}", subComponent, progressDescription, percentComplete);
		}
 public ZipUIForm(TaskHost taskHost)
 {
     InitializeComponent();
     this._taskHost = taskHost;
 }
        private static void HookupRowCountTransform(TaskHost dataFlowTask, MainPipe pipeline, IDTSOutputXX output)
        {
            Variable variable = dataFlowTask.Variables.Add("BIDS_HELPER_ROWCOUNT_" + output.ID, false, "User", (int)0);

            IDTSComponentMetaDataXX transform = pipeline.ComponentMetaDataCollection.New();
            transform.ComponentClassID = "DTSTransform.RowCount";
            CManagedComponentWrapper inst = transform.Instantiate();
            inst.ProvideComponentProperties();
            inst.SetComponentProperty("VariableName", variable.QualifiedName);

            string sOutputName = output.Name;
            int iComponentID = output.Component.ID;

            IDTSPathXX path = pipeline.PathCollection.New();
            path.AttachPathAndPropagateNotifications(output, transform.InputCollection[0]);

            transform.Name = "BIDS_Helper_RowCount_" + path.StartPoint.ID.ToString();
        }
 //to workaround a problem when we're testing the error branch of a flat file source. There must be a main output from such a source, and this puts a rowcount on that output.
 private static void AttachRowCountTransformToAllUnattachedOutputs(TaskHost dataFlowTask, MainPipe pipeline)
 {
     foreach (IDTSComponentMetaDataXX component in pipeline.ComponentMetaDataCollection)
     {
         if (!component.Name.StartsWith("BIDS_Helper_"))
         {
             foreach (IDTSOutputXX output in component.OutputCollection)
             {
                 if (!output.IsAttached && !output.IsErrorOut)
                 {
                     HookupRowCountTransform(dataFlowTask, pipeline, output);
                 }
             }
         }
     }
 }
Exemple #56
0
		public void OnTaskFailed(TaskHost taskHost)
		{
		}
        private void PrepareResults(string packageFile, TaskHost taskHost, string containerName = null) {
            if(taskHost != null) {
                if((containerName != null) && ((taskHost.InnerObject is MainPipe) || (taskHost.InnerObject is ExecuteSQLTask))) {
                    List<string> containerNameList = new List<string>();
                    containerNameList.Add(containerName + NEW_LINE);
                    _allResults.Add(CONTAINER_NAME_KEY + _multipleTasksContainerCounter.ToString(), containerNameList);
                    _multipleTasksContainerCounter++;
                }

                if(taskHost.InnerObject is MainPipe) {
                    AddDataFlowTaskInfo(packageFile, taskHost.Name, taskHost, containerName);
                }

                if(taskHost.InnerObject is ExecuteSQLTask) {
                    AddExecuteSQLTaskInfo(packageFile, taskHost.Name, taskHost, containerName);
                }
            }
        }
        private void AddExecuteSQLTaskInfo(string packageFile, string taskHostName, TaskHost taskHost, string containerName = null) {
            List<string> taskContent = new List<string>();

            if(containerName != null) {
                taskContent.Add(containerName);
            }

            taskContent.Add(packageFile);
            taskContent.Add(taskHost.Description + H_TAB + taskHostName);                                   // taskHostName == table name
            taskContent.Add(taskHost.Properties[SQL_STATEMENT_SOURCE].GetValue(taskHost).ToString());       // PropertyExpression
            taskContent.Add(NEW_LINE);

            _allResults.Add(_taskCounter.ToString(), taskContent);
            _taskCounter++;
        }
 public void Initialize(TaskHost taskHost, IServiceProvider serviceProvider)
 {
     this._taskHost = taskHost;
     this._connectionService = serviceProvider.GetService(typeof(IDtsConnectionService)) as IDtsConnectionService;
 }
Exemple #60
0
 public void OnProgress(TaskHost taskHost, string progressDescription, int percentComplete, int progressCountLow, int progressCountHigh, string subComponent, ref bool fireAgain)
 {
 }