internal IDTSParameterAssignment AddParameterAssignment(string bindedVariableOrParameterName, string childParameterName) { IDTSParameterAssignment prmAss = ExecutePackageTask.ParameterAssignments.Add(); prmAss.BindedVariableOrParameterName = bindedVariableOrParameterName; prmAss.ParameterName = childParameterName; return(prmAss); }
private void CheckExecutePackageTask(TaskHost taskHost, TreeNode parent) { ExecutePackageTask task = taskHost.InnerObject as ExecutePackageTask; TreeNode parameterAssignments = AddFolder("ParameterAssignments", parent); // IDTSParameterAssignment doesn't support foreach enumeration, so use for loop instead. for (int i = 0; i < task.ParameterAssignments.Count; i++) { IDTSParameterAssignment assignment = task.ParameterAssignments[i]; string match; string value = assignment.BindedVariableOrParameterName; if (!string.IsNullOrEmpty(value) && PropertyMatchEval(value, out match)) { VariableFoundEventArgs info = new VariableFoundEventArgs(); info.Match = match; OnRaiseVariableFound(info); AddNode(parameterAssignments, assignment.ParameterName.ToString(), GetImageIndex(IconKeyProperty), assignment, true); } } }
private void CheckExecutePackageTask(TaskHost taskHost, TreeNode parent) { // We have a reference to Microsoft.SqlServer.ExecPackageTaskWrap.dll // Only ever use interfaces which are consistent between versions of SSIS, cannot use reflection because task is native, not managed code. IDTSExecutePackage100 task = taskHost.InnerObject as IDTSExecutePackage100; // Potential issue because of multiple version support in SQL Server 2016+. Is the reference to the correct version? if (task == null) { // Task is null following cast to IDTSExecutePackage100, therefore we have the wrong Microsoft.SqlServer.ExecPackageTaskWrap reference // Produce a false found variable for feedback to the UI, else a null referece exception will break the search VariableFoundEventArgs info = new VariableFoundEventArgs(); info.Match = "Invalid IDTSExecutePackage100 reference"; OnRaiseVariableFound(info); AddNode(parent, info.Match, GetImageIndex(IconKeyError), new DisplayProperty("InvalidIDTSExecutePackage100", info.Match), true); return; } TreeNode parameterAssignments = AddFolder("ParameterAssignments", parent); // IDTSParameterAssignment doesn't support foreach enumeration, so use for loop instead. // Why? ParameterAssignments -> IDTSParameterAssignments -> IEnumerable for (int i = 0; i < task.ParameterAssignments.Count; i++) { IDTSParameterAssignment assignment = task.ParameterAssignments[i]; string match; string value = assignment.BindedVariableOrParameterName; if (!string.IsNullOrEmpty(value) && PropertyMatchEval(value, out match)) { VariableFoundEventArgs info = new VariableFoundEventArgs(); info.Match = match; OnRaiseVariableFound(info); AddNode(parameterAssignments, assignment.ParameterName.ToString(), GetImageIndex(IconKeyProperty), assignment, true); } } }
/// <summary> /// A ctor that accepts a IDTSParameterAssignment object /// </summary> /// <param name="parameterAssignment"></param> internal ISExecutePackageTaskParameterBinding(IDTSParameterAssignment parameterAssignment) { _paramAss = parameterAssignment; }