//private List<ISExternalMetadataColumn> _externalMetadataColumnCollection = new List<ISExternalMetadataColumn>(); //public List<ISExternalMetadataColumn> ExternalMetadataColumnCollection //{ // get // { // _externalMetadataColumnCollection.Clear(); // foreach (IDTSExternalMetadataColumn100 emc in ExternalMetadataColumnCollection_m) // { // _externalMetadataColumnCollection.Add(new ISExternalMetadataColumn(emc)); // } // return _externalMetadataColumnCollection; // } //} #endregion #region ColumnCollection //public List<ISOutputColumn> ColumnCollection //{ // get // { // List<ISOutputColumn> _outputColumns = new List<ISOutputColumn>(); // foreach (IDTSOutputColumn100 col in Output.OutputColumnCollection) // { // _outputColumns.Add(new ISOutputColumn(ParentComponent, Output.Name, col.Name)); // } // return _outputColumns; // } // set // { // } //} #endregion #endregion #region ctor public ISOutput(ISPipelineComponent parentComponent, int outputIndex = 0) { ParentComponent = parentComponent; if (ParentComponent.ComponentMetaData.OutputCollection.Count > 0) { Output = ParentComponent.GetOutputFromIndex(outputIndex); } }
/// <summary> /// A ctor that accepts a parent data fllow, a name for the component and the previous component (and output) to which this is connected /// </summary> public ISScriptComponent(ISDataFlowTask parentDataFlowTask, string componentname, ISPipelineComponent sourceComponent, ISOutput sourceOutput, int thisComponentInput = 0) : this(parentDataFlowTask, componentname) { if (sourceOutput != null) { ConnectToAnotherPipelineComponent(sourceComponent.Name, sourceOutput.Name, thisComponentInput); } else { ConnectToAnotherPipelineComponent(sourceComponent.Name, sourceComponent.GetOutputFromIndex(0).Name, thisComponentInput); } }
/// <summary> /// First check if an Output with the given name exists on the Component. /// If it exists, then assign that output to the Output property /// If it does not exist: /// Check if more outputs can be added or not. /// If more outputs can be added, then add a new output /// If more outputs cannot be added, then assign the first (non error ) output in the component's collection to the Output property /// </summary> /// <param name="parentComponent"></param> /// <param name="name"></param> public ISOutput(ISPipelineComponent parentComponent, string name, int referenceOutputIndex = 0, InsertPlacement beforeOrAfter = InsertPlacement.IP_BEFORE) { ParentComponent = parentComponent; bool outputExists = false; for (int i = 0; i < ParentComponent.ComponentMetaData.OutputCollection.Count; i++) { if (ParentComponent.ComponentMetaData.OutputCollection[i].Name == name) { Output = ParentComponent.ComponentMetaData.OutputCollection[i]; outputExists = true; } } // check if more outputs can be added int existingOutputCount = parentComponent.ComponentMetaData.OutputCollection.Count; if (ParentComponent._numberOfOutputsAllowed == -1) { if (!(outputExists)) { Output = parentComponent.DesignTimeComponent.InsertOutput(DtsUtility.EnumAToEnumB <InsertPlacement, DTSInsertPlacement>(beforeOrAfter), ParentComponent.GetOutputFromIndex(referenceOutputIndex).ID); Name = name; } } else { if (existingOutputCount < parentComponent._numberOfOutputsAllowed) { if (!(outputExists)) { Output = parentComponent.DesignTimeComponent.InsertOutput(DTSInsertPlacement.IP_BEFORE, ParentComponent.GetOutputFromIndex(referenceOutputIndex).ID); Name = name; } } else { if (!outputExists) { Console.WriteLine("WARN::: Only {1} output(s) are allowed. A new output with the name '{0}' cannot be added. Therefore, the name '{0}' is assigned to the first non error output in the collection", name, existingOutputCount.ToString()); Output = parentComponent.ComponentMetaData.OutputCollection[0]; Name = name; } } } }