public CouchbaseSourceAdapterUIForm(Connections cons, Variables vars, IDTSComponentMetaData100 md) { InitializeComponent(); variables = vars; connections = cons; metaData = md; this.Text = metaData.Name + " Configuration"; if (designTimeInstance == null) { designTimeInstance = metaData.Instantiate(); } txtURL.Text = metaData.CustomPropertyCollection["url"].Value.ToString(); txtBucket.Text = metaData.CustomPropertyCollection["bucket"].Value.ToString(); txtPassword.Text = metaData.CustomPropertyCollection["password"].Value.ToString(); txtDesignDoc.Text = metaData.CustomPropertyCollection["designDoc"].Value.ToString(); txtView.Text = metaData.CustomPropertyCollection["view"].Value.ToString(); cbForceReindex.Checked = metaData.CustomPropertyCollection["forceReindex"].Value; cbDescending.Checked = metaData.CustomPropertyCollection["descending"].Value; txtStartKey.Text = metaData.CustomPropertyCollection["startKey"].Value.ToString(); txtEndKey.Text = metaData.CustomPropertyCollection["endKey"].Value.ToString(); string modelXML = metaData.CustomPropertyCollection["modelXML"].Value.ToString(); model = new JSONDataModel(); if (!modelXML.Trim().Equals("")) { model = new JSONDataModel(modelXML); } }
public override IDTSComponentMetaData100 Initialize() { IDTSComponentMetaData100 comp = base.Initialize(); // create the adonet source //set connection properies _cm.Name = "AdoNet Source Connection Manager"; _cm.ConnectionString = _src.ConnectionString; _cm.Description = _src.Description; //cm.Qualifier = "System.Data.SqlClient.SqlConnection, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; if (!String.IsNullOrEmpty(_src.DBConnection.Qualifier)) { _cm.Qualifier = _src.DBConnection.Qualifier; } CManagedComponentWrapper dcomp = comp.Instantiate(); //set Component Custom Properties foreach (KeyValuePair <string, object> prop in _src.CustomProperties.CustomPropertyCollection.InnerArrayList) { dcomp.SetComponentProperty(prop.Key, prop.Value); } if (comp.RuntimeConnectionCollection.Count > 0) { comp.RuntimeConnectionCollection[0].ConnectionManagerID = _cm.ID; comp.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.GetExtendedInterface(_cm); } // Finalize Reinitialize(dcomp); return(comp); }
public SSISAdoNetSource(AdoNetSource dbsrc, MainPipe pipe, ConnectionManager cm) : base(pipe, "ADO NET Source") { // create the adonet source //set connection properies cm.Name = "AdoNet Source Connection Manager"; cm.ConnectionString = dbsrc.ConnectionString; cm.Description = dbsrc.Description; //cm.Qualifier = "System.Data.SqlClient.SqlConnection, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; cm.Qualifier = dbsrc.DBConnection.Qualifier; IDTSComponentMetaData100 comp = this.MetadataCollection; CManagedComponentWrapper dcomp = comp.Instantiate(); //set Component Custom Properties foreach (KeyValuePair <string, object> prop in dbsrc.CustomProperties.CustomPropertyCollection.InnerArrayList) { dcomp.SetComponentProperty(prop.Key, prop.Value); } if (comp.RuntimeConnectionCollection.Count > 0) { comp.RuntimeConnectionCollection[0].ConnectionManagerID = cm.ID; comp.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.GetExtendedInterface(cm); } // Finalize this.Reinitialize(dcomp); }
public void TestChangeRowsProcessedOutputTypeToData() { Microsoft.SqlServer.Dts.Runtime.Package package = new Microsoft.SqlServer.Dts.Runtime.Package(); Executable exec = package.Executables.Add("STOCK:PipelineTask"); Microsoft.SqlServer.Dts.Runtime.TaskHost thMainPipe = exec as Microsoft.SqlServer.Dts.Runtime.TaskHost; MainPipe dataFlowTask = thMainPipe.InnerObject as MainPipe; ComponentEventHandler events = new ComponentEventHandler(); dataFlowTask.Events = DtsConvert.GetExtendedInterface(events as IDTSComponentEvents); IDTSComponentMetaData100 textFileSplitter = dataFlowTask.ComponentMetaDataCollection.New(); textFileSplitter.Name = "Row Splitter Test"; textFileSplitter.ComponentClassID = typeof(Martin.SQLServer.Dts.TextFileSplitter).AssemblyQualifiedName; CManagedComponentWrapper instance = textFileSplitter.Instantiate(); instance.ProvideComponentProperties(); Boolean exceptionThrown = false; try { instance.SetOutputProperty(textFileSplitter.OutputCollection[3].ID, ManageProperties.typeOfOutput, Utilities.typeOfOutputEnum.DataRecords); } catch (COMException ex) { Assert.AreEqual(MessageStrings.CantChangeOutputProperties("RowsProcessed"), ex.Message, "Exception Message Wrong"); exceptionThrown = true; } Assert.IsTrue(exceptionThrown, "Exception Not Thrown"); }
public UnionAll( VulcanPackage vulcanPackage, MainPipe dataFlowTask, IDTSComponentMetaData90 parentComponent, string name, string description ) : base( vulcanPackage, dataFlowTask, parentComponent, name, description ) { unionAllCom = dataFlowTask.ComponentMetaDataCollection.New(); unionAllCom.ComponentClassID = "DTSTransform.UnionAll"; unionAllComI = unionAllCom.Instantiate(); unionAllComI.ProvideComponentProperties(); unionAllCom.Name = name; unionAllCom.OutputCollection[0].ErrorRowDisposition = DTSRowDisposition.RD_NotUsed; }
public override IDTSComponentMetaData100 Initialize() { //create flat file destination component IDTSComponentMetaData100 comp = base.Initialize(); _cm.Name = $"FlatFile Destination Connection Manager {comp.ID}"; //Create a new FlatFileDestination component CManagedComponentWrapper dcomp = comp.Instantiate(); foreach (KeyValuePair <string, object> prop in _dst.CustomProperties.CustomPropertyCollection.InnerArrayList) { dcomp.SetComponentProperty(prop.Key, prop.Value); } /*Specify the connection manager for Src.The Connections class is a collection of the connection managers that have been added to that package and are available for use at run time*/ if (comp.RuntimeConnectionCollection.Count > 0) { comp.RuntimeConnectionCollection[0].ConnectionManagerID = _cm.ID; comp.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.GetExtendedInterface(_cm); } this.Reinitialize(dcomp); return(comp); }
public SSISExcelSource(ExcelSource dbsrc, MainPipe pipe, ConnectionManager cm) : base(pipe, "Excel Source") { // create the oledb source //set connection properies cm.Name = "Excel Source Connection Manager"; cm.ConnectionString = dbsrc.ConnectionString; cm.Description = dbsrc.Description; //set connection properties //mwrt.IDTSConnectionManagerExcel100 ecm = cm.InnerObject as mwrt.IDTSConnectionManagerExcel100; //ecm.ExcelFilePath = dbsrc.FilePath; //ecm.FirstRowHasColumnName = dbsrc.Header; //ecm.ExcelVersionNumber = mwrt.DTSExcelVersion.DTSExcelVer_2007; IDTSComponentMetaData100 comp = this.MetadataCollection; CManagedComponentWrapper dcomp = comp.Instantiate(); foreach (KeyValuePair <string, object> prop in dbsrc.CustomProperties.CustomPropertyCollection.InnerArrayList) { dcomp.SetComponentProperty(prop.Key, prop.Value); } /*Specify the connection manager for Src.The Connections class is a collection of the connection managers that have been added to that package and are available for use at run time*/ if (comp.RuntimeConnectionCollection.Count > 0) { comp.RuntimeConnectionCollection[0].ConnectionManagerID = cm.ID; comp.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.GetExtendedInterface(cm); } // Finalize this.Reinitialize(dcomp); }
public SSISOdbcSource(OdbcSource dbsrc, MainPipe pipe, ConnectionManager cm) : base(pipe, "ODBC Source") { // create the odbc source //set connection properies cm.Name = "ODBC Source Connection Manager"; cm.ConnectionString = dbsrc.ConnectionString; cm.Description = dbsrc.Description; //do not require Qualifier //cm.Qualifier = dbsrc.DBConnection.Qualifier; IDTSComponentMetaData100 comp = this.MetadataCollection; CManagedComponentWrapper dcomp = comp.Instantiate(); //set Component Custom Properties foreach (KeyValuePair <string, object> prop in dbsrc.CustomProperties.CustomPropertyCollection.InnerArrayList) { dcomp.SetComponentProperty(prop.Key, prop.Value); } if (comp.RuntimeConnectionCollection.Count > 0) { comp.RuntimeConnectionCollection[0].ConnectionManagerID = cm.ID; comp.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.GetExtendedInterface(cm); } // Finalize this.Reinitialize(dcomp); }
public void TestSetOutputColumnDefaults() { Microsoft.SqlServer.Dts.Runtime.Package package = new Microsoft.SqlServer.Dts.Runtime.Package(); Executable exec = package.Executables.Add("STOCK:PipelineTask"); Microsoft.SqlServer.Dts.Runtime.TaskHost thMainPipe = exec as Microsoft.SqlServer.Dts.Runtime.TaskHost; MainPipe dataFlowTask = thMainPipe.InnerObject as MainPipe; IDTSComponentMetaData100 textFileSplitter = dataFlowTask.ComponentMetaDataCollection.New(); ComponentEventHandler events = new ComponentEventHandler(); dataFlowTask.Events = DtsConvert.GetExtendedInterface(events as IDTSComponentEvents); textFileSplitter.Name = "Row Splitter Test"; textFileSplitter.ComponentClassID = typeof(Martin.SQLServer.Dts.TextFileSplitter).AssemblyQualifiedName; CManagedComponentWrapper instance = textFileSplitter.Instantiate(); instance.ProvideComponentProperties(); IDTSOutput100 output = textFileSplitter.OutputCollection.New(); IDTSOutputColumn100 actual = output.OutputColumnCollection.New(); ManageColumns.SetOutputColumnDefaults(actual, 1252); Assert.AreEqual(DataType.DT_STR, actual.DataType, "DataType is wrong"); Assert.AreEqual(255, actual.Length, "Length is wrong"); Assert.AreEqual(DTSRowDisposition.RD_NotUsed, actual.ErrorRowDisposition, "Row Disposition is wrong"); Assert.AreEqual(DTSRowDisposition.RD_NotUsed, actual.TruncationRowDisposition, "Truncate Disposition is wrong"); }
protected virtual void MatchInputColumns(Dictionary <string, int> converted, bool needschema) { IDTSComponentMetaData100 comp = this.MetadataCollection; CManagedComponentWrapper dcomp = comp.Instantiate(); IDTSInput100 input = comp.InputCollection[0]; IDTSVirtualInput100 vInput = input.GetVirtualInput(); IDTSVirtualInputColumnCollection100 vColumns = vInput.VirtualInputColumnCollection; IDTSExternalMetadataColumnCollection100 exColumns = input.ExternalMetadataColumnCollection; if (exColumns != null && exColumns.Count > 0) { bool hasMatch = false; foreach (IDTSExternalMetadataColumn100 exColumn in exColumns) { int inputColId; if (converted.ContainsKey(exColumn.Name.ToLower())) { inputColId = (int)converted[exColumn.Name.ToLower()]; } else { inputColId = FindVirtualInputColumnId(vColumns, exColumn.Name); } if (inputColId == 0) { //the column wasn't found if the Id is 0, so we'll print out a message and skip this row. PrintOutput.PrintToOutput("DE could not map external column " + exColumn.Name + ". Skipping column.", DERun.Debug); } else { // create input column IDTSInputColumn100 vCol = dcomp.SetUsageType(input.ID, vInput, inputColId, DTSUsageType.UT_READONLY); // and then we'll map it to the input row. dcomp.MapInputColumn(input.ID, vCol.ID, exColumn.ID); hasMatch = true; } } if (!hasMatch) { throw new InvalidArgumentException("Unable to map input to destination"); } } //if output schema is required and not provided else if (needschema) { //PrintOutput.PrintToError("No destination columns available"); throw new InvalidArgumentException("No destination columns available"); } //otherwise use virtual inputs else { foreach (IDTSVirtualInputColumn100 vColumn in vColumns) { // create input column for all virtual input columns dcomp.SetUsageType(input.ID, vInput, vColumn.LineageID, DTSUsageType.UT_READONLY); } } }
protected SSISModule(MainPipe pipe, string module_name, int module_id, string module_clsid) { //create SSIS component m_pipe = pipe; IDTSComponentMetaData100 comp = pipe.ComponentMetaDataCollection.New(); m_ID = comp.ID; Application app = new Application(); comp.ComponentClassID = (String.IsNullOrEmpty(module_clsid)) ? app.PipelineComponentInfos[module_name].CreationName : module_clsid; CManagedComponentWrapper dcomp = comp.Instantiate(); dcomp.ProvideComponentProperties(); //set common SSIS module properties if (module_id == 0) { comp.Name = String.Format(CultureInfo.InvariantCulture, "{0}", module_name); } else { comp.Name = String.Format(CultureInfo.InvariantCulture, "{0} - {1}", module_name, module_id); } PrintOutput.PrintToOutput(String.Format(CultureInfo.InvariantCulture, "DE added {0}", comp.Name), DERun.Debug); }
public void TestValidateOK() { Microsoft.SqlServer.Dts.Runtime.Package package = new Microsoft.SqlServer.Dts.Runtime.Package(); Executable exec = package.Executables.Add("STOCK:PipelineTask"); Microsoft.SqlServer.Dts.Runtime.TaskHost thMainPipe = exec as Microsoft.SqlServer.Dts.Runtime.TaskHost; MainPipe dataFlowTask = thMainPipe.InnerObject as MainPipe; ComponentEventHandler events = new ComponentEventHandler(); dataFlowTask.Events = DtsConvert.GetExtendedInterface(events as IDTSComponentEvents); IDTSComponentMetaData100 speechToText = dataFlowTask.ComponentMetaDataCollection.New(); speechToText.ComponentClassID = typeof(Martin.SQLServer.Dts.SSISSpeechToText).AssemblyQualifiedName; CManagedComponentWrapper speechToTextInstance = speechToText.Instantiate(); speechToTextInstance.ProvideComponentProperties(); speechToText.CustomPropertyCollection[Utility.SubscriptionKeyPropName].Value = "NotTheDefault"; DTSValidationStatus actual = speechToTextInstance.Validate(); DTSValidationStatus expected = DTSValidationStatus.VS_ISVALID; Assert.AreEqual(expected, actual); Assert.AreEqual(0, events.errorMessages.Count, "There are error messages"); }
public override IDTSComponentMetaData100 Initialize() { // create the odbc source IDTSComponentMetaData100 comp = base.Initialize(); //set connection properies _cm.Name = "ODBC Source Connection Manager"; _cm.ConnectionString = _src.ConnectionString; _cm.Description = _src.Description; //do not require Qualifier //cm.Qualifier = dbsrc.DBConnection.Qualifier; CManagedComponentWrapper dcomp = comp.Instantiate(); //set Component Custom Properties foreach (KeyValuePair <string, object> prop in _src.CustomProperties.CustomPropertyCollection.InnerArrayList) { dcomp.SetComponentProperty(prop.Key, prop.Value); } if (comp.RuntimeConnectionCollection.Count > 0) { comp.RuntimeConnectionCollection[0].ConnectionManagerID = _cm.ID; comp.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.GetExtendedInterface(_cm); } // Finalize Reinitialize(dcomp); return(comp); }
private void ReplaceInput(MainPipe mainPipe, IDTSInput input, Dataset dataset) { var placeholderSource = mainPipe.ComponentMetaDataCollection.New(); placeholderSource.ComponentClassID = typeof(SsisUnitSource).AssemblyQualifiedName; CManagedComponentWrapper wrapper = placeholderSource.Instantiate(); wrapper.ProvideComponentProperties(); wrapper.SetComponentProperty("TestData", GetDataSet(dataset)); #if DEBUG for (int i = 0; i < placeholderSource.OutputCollection[0].OutputColumnCollection.Count; i++) { System.Diagnostics.Debug.Print(placeholderSource.OutputCollection[0].OutputColumnCollection[i].Name); } #endif var path = Helper.FindPath(mainPipe, input); mainPipe.PathCollection.RemoveObjectByID(path.ID); path = mainPipe.PathCollection.New(); path.AttachPathAndPropagateNotifications(placeholderSource.OutputCollection[0], input); // TODO: Remap IDs? - Failing downstream because of invalid column references. // Could remap ids, or clone the output column ids from the original source - that will mean changing the source component. }
public void TestAddNumberOfRowsOutputColumns() { Microsoft.SqlServer.Dts.Runtime.Package package = new Microsoft.SqlServer.Dts.Runtime.Package(); Executable exec = package.Executables.Add("STOCK:PipelineTask"); Microsoft.SqlServer.Dts.Runtime.TaskHost thMainPipe = exec as Microsoft.SqlServer.Dts.Runtime.TaskHost; MainPipe dataFlowTask = thMainPipe.InnerObject as MainPipe; IDTSComponentMetaData100 textFileSplitter = dataFlowTask.ComponentMetaDataCollection.New(); ComponentEventHandler events = new ComponentEventHandler(); dataFlowTask.Events = DtsConvert.GetExtendedInterface(events as IDTSComponentEvents); textFileSplitter.Name = "Row Splitter Test"; textFileSplitter.ComponentClassID = typeof(Martin.SQLServer.Dts.TextFileSplitter).AssemblyQualifiedName; CManagedComponentWrapper instance = textFileSplitter.Instantiate(); instance.ProvideComponentProperties(); IDTSOutput100 actual = textFileSplitter.OutputCollection.New(); ManageColumns.AddNumberOfRowsOutputColumns(actual); Assert.AreEqual(3, actual.OutputColumnCollection.Count, "Number of Columns is wrong"); Assert.AreEqual(MessageStrings.KeyValueColumnName, actual.OutputColumnCollection[0].Name, "Column Name is wrong"); Assert.AreEqual(DataType.DT_STR, actual.OutputColumnCollection[0].DataType, "DataType is wrong"); Assert.AreEqual(255, actual.OutputColumnCollection[0].Length, "Length is wrong"); Assert.AreEqual(MessageStrings.KeyValueColumnDescription, actual.OutputColumnCollection[0].Description, "Description is wrong"); Assert.AreEqual(MessageStrings.NumberOfRowsColumnName, actual.OutputColumnCollection[1].Name, "Column Name is wrong"); Assert.AreEqual(DataType.DT_I8, actual.OutputColumnCollection[1].DataType, "DataType is wrong"); Assert.AreEqual(0, actual.OutputColumnCollection[1].Length, "Length is wrong"); Assert.AreEqual(MessageStrings.NumberOfRowsColumnDescription, actual.OutputColumnCollection[1].Description, "Description is wrong"); Assert.AreEqual(MessageStrings.KeyValueStatusColumnName, actual.OutputColumnCollection[2].Name, "Column Name is wrong"); Assert.AreEqual(DataType.DT_STR, actual.OutputColumnCollection[2].DataType, "DataType is wrong"); Assert.AreEqual(255, actual.OutputColumnCollection[2].Length, "Length is wrong"); Assert.AreEqual(MessageStrings.KeyValueStatusColumnDescription, actual.OutputColumnCollection[2].Description, "Description is wrong"); }
public static void SetTableStorageDestination(this CManagedComponentWrapper InstanceDestination, string TableName, string azureTableConnection) { string accountName = string.Empty; string accountKey = string.Empty; string defaultEndpointsProtocol = "http"; foreach (string str in azureTableConnection.Split(';')) { if (str.Contains("AccountName")) { accountName = str.Substring(str.IndexOf("=") + 1); } else if (str.Contains("AccountKey")) { accountKey = str.Substring(str.IndexOf("=") + 1); } else if (str.Contains("DefaultEndpointsProtocol")) { defaultEndpointsProtocol = str.Substring(str.IndexOf("=") + 1); } } InstanceDestination.SetComponentProperty("AccountName", accountName); InstanceDestination.SetComponentProperty("AccountKey", accountKey); InstanceDestination.SetComponentProperty("DefaultEndpointsProtocol", defaultEndpointsProtocol); InstanceDestination.SetComponentProperty("TableName", TableName); }
public void TestExecuteRecogniseAsyncBasic() { Microsoft.SqlServer.Dts.Runtime.Package package = new Microsoft.SqlServer.Dts.Runtime.Package(); Executable exec = package.Executables.Add("STOCK:PipelineTask"); Microsoft.SqlServer.Dts.Runtime.TaskHost thMainPipe = exec as Microsoft.SqlServer.Dts.Runtime.TaskHost; MainPipe dataFlowTask = thMainPipe.InnerObject as MainPipe; ComponentEventHandler events = new ComponentEventHandler(); dataFlowTask.Events = DtsConvert.GetExtendedInterface(events as IDTSComponentEvents); IDTSComponentMetaData100 speechToText = dataFlowTask.ComponentMetaDataCollection.New(); speechToText.ComponentClassID = typeof(Martin.SQLServer.Dts.SSISSpeechToText).AssemblyQualifiedName; CManagedComponentWrapper speechToTextInstance = speechToText.Instantiate(); speechToTextInstance.ProvideComponentProperties(); speechToText.CustomPropertyCollection[Utility.SubscriptionKeyPropName].Value = config.AppSettings.Settings["subscriptionKey"].Value; Uri targetURI = new Uri(@"wss://speech.platform.bing.com/api/service/recognition/continuous"); SpeechToTextImplement testMe = new SpeechToTextImplement(speechToText, "en-us", targetURI, config.AppSettings.Settings["subscriptionKey"].Value); string filename = "Ex_Pro_1.mp3"; testMe.ExecuteRecogniseAsync(filename).Wait(); Assert.IsTrue(testMe.Results.Count > 0); }
// Creates Source Component (Output Collection) internal void CreateSourceComponent() { // Creates mainpipe for the executable component _objMainPipe = ((TaskHost)_objPackage.Executables.Add(_strDataFlowTaskMoniker)).InnerObject as MainPipe; // Adds a component from the MainPipe to the Source Metadata _objIDTSSRCMetaData = _objMainPipe.ComponentMetaDataCollection.New(); // Sets the source component class id _objIDTSSRCMetaData.ComponentClassID = _strSourceDFComponentID; // Sets the locale property _objIDTSSRCMetaData.LocaleID = -1; // Instantiates the Wrapper, adding Source Metadata _objSourceWrapper = _objIDTSSRCMetaData.Instantiate(); // Provides default properties _objSourceWrapper.ProvideComponentProperties(); // Sets RAWFile Component Property _objSourceWrapper.SetComponentProperty("AccessMode", 0); _objSourceWrapper.SetComponentProperty("FileName", strRAWFileName); _objSourceWrapper.SetComponentProperty("FileNameVariable", null); // Sets the connection _objSourceWrapper.AcquireConnections(null); // Reinitializes the Source Metadata _objSourceWrapper.ReinitializeMetaData(); // Fetch ColumnNames for the Metadata if (_strRAWColNames.Length == 0 && _strRAWColNames.ToString() == string.Empty) { foreach (IDTSOutputColumn100 idtsOutPutColumn in _objIDTSSRCMetaData.OutputCollection[0].OutputColumnCollection) { _strRAWColNames.Append(idtsOutPutColumn + ","); } } // Releases the Wrapper connection _objSourceWrapper.ReleaseConnections(); }
public IDTSComponentMetaData100 AddComp_Multicast(string ComponentName, IDTSOutput100 outCols ) { // Create IDTSComponentMetaData100 Comp = dmp.ComponentMetaDataCollection.New(); Comp.ComponentClassID = "Microsoft.Multicast"; // Instantiate CManagedComponentWrapper Inst = Comp.Instantiate(); Inst.ProvideComponentProperties(); Comp.Name = ComponentName; Comp.Description = "Dodany Sort"; // Connect IDTSPath100 pth = dmp.PathCollection.New(); pth.AttachPathAndPropagateNotifications(outCols, Comp.InputCollection[0]); // Return return(Comp); }
public void TestValidateExtraCustomProperty() { Microsoft.SqlServer.Dts.Runtime.Package package = new Microsoft.SqlServer.Dts.Runtime.Package(); Executable exec = package.Executables.Add("STOCK:PipelineTask"); Microsoft.SqlServer.Dts.Runtime.TaskHost thMainPipe = exec as Microsoft.SqlServer.Dts.Runtime.TaskHost; MainPipe dataFlowTask = thMainPipe.InnerObject as MainPipe; ComponentEventHandler events = new ComponentEventHandler(); dataFlowTask.Events = DtsConvert.GetExtendedInterface(events as IDTSComponentEvents); IDTSComponentMetaData100 speechToText = dataFlowTask.ComponentMetaDataCollection.New(); speechToText.ComponentClassID = typeof(Martin.SQLServer.Dts.SSISSpeechToText).AssemblyQualifiedName; CManagedComponentWrapper speechToTextInstance = speechToText.Instantiate(); speechToTextInstance.ProvideComponentProperties(); speechToText.CustomPropertyCollection.New(); DTSValidationStatus actual = speechToTextInstance.Validate(); DTSValidationStatus expected = DTSValidationStatus.VS_ISCORRUPT; Assert.AreEqual(expected, actual); Assert.AreEqual("[Error] SSIS Speech To Text: There is either to many or not enough custom properties.", events.errorMessages[0]); }
public void TestOutputColumn_InvalidCustomProperty() { Microsoft.SqlServer.Dts.Runtime.Package package = new Microsoft.SqlServer.Dts.Runtime.Package(); Executable exec = package.Executables.Add("STOCK:PipelineTask"); Microsoft.SqlServer.Dts.Runtime.TaskHost thMainPipe = exec as Microsoft.SqlServer.Dts.Runtime.TaskHost; MainPipe dataFlowTask = thMainPipe.InnerObject as MainPipe; ComponentEventHandler events = new ComponentEventHandler(); dataFlowTask.Events = DtsConvert.GetExtendedInterface(events as IDTSComponentEvents); IDTSComponentMetaData100 speechToText = dataFlowTask.ComponentMetaDataCollection.New(); speechToText.ComponentClassID = typeof(Martin.SQLServer.Dts.SSISSpeechToText).AssemblyQualifiedName; CManagedComponentWrapper speechToTextInstance = speechToText.Instantiate(); speechToTextInstance.ProvideComponentProperties(); speechToText.CustomPropertyCollection[Utility.SubscriptionKeyPropName].Value = "NotTheDefault"; // Before this is default setup for a clean component IDTSCustomProperty100 cp = speechToText.OutputCollection[0].OutputColumnCollection[0].CustomPropertyCollection.New(); cp.Name = "IAmInvalid"; cp.Value = "IAmInvalid"; DTSValidationStatus actual = speechToTextInstance.Validate(); DTSValidationStatus expected = DTSValidationStatus.VS_ISCORRUPT; Assert.AreEqual(expected, actual); Assert.AreEqual("[Error] SSIS Speech To Text: Output Column InputChannel has invalid property IAmInvalid.", events.errorMessages[0]); }
public DerivedColumns(Packages.VulcanPackage vulcanPackage, MainPipe dataFlowTask, IDTSComponentMetaData90 parentComponent, string name, string description ) : base(vulcanPackage, dataFlowTask, parentComponent, name, description) { _dcCom = dataFlowTask.ComponentMetaDataCollection.New(); _dcCom.ComponentClassID = "DTSTransform.DerivedColumn"; //IMPORTANT! If you do not Instantiate() first, the component names do not get set... this is bad. _dci = _dcCom.Instantiate(); _dci.ProvideComponentProperties(); _dcCom.Name = Name; _dcCom.Description = Description; dataFlowTask.PathCollection.New().AttachPathAndPropagateNotifications( parentComponent.OutputCollection[0], _dcCom.InputCollection[0] ); _dci.AcquireConnections(null); _dci.ReinitializeMetaData(); _dci.ReleaseConnections(); }
public IDTSComponentMetaData100 AddComp_DerivedCol(string ComponentName, IDTSOutput100 outCols ) { // Create IDTSComponentMetaData100 Comp = dmp.ComponentMetaDataCollection.New(); Comp.ComponentClassID = "Microsoft.DerivedColumn"; // Instantiate CManagedComponentWrapper Inst = Comp.Instantiate(); Inst.ProvideComponentProperties(); Comp.Name = ComponentName; Comp.Description = "Derajw kolumn"; // Parametrize Comp.OutputCollection[0].TruncationRowDisposition = DTSRowDisposition.RD_NotUsed; Comp.OutputCollection[0].ErrorRowDisposition = DTSRowDisposition.RD_NotUsed; // Connect IDTSPath100 pth = dmp.PathCollection.New(); pth.AttachPathAndPropagateNotifications(outCols, Comp.InputCollection[0]); // Return return(Comp); }
public ConditionalSplit(Packages.VulcanPackage vulcanPackage, MainPipe dataFlowTask, IDTSComponentMetaData90 parentComponent, string name, string description) : base(vulcanPackage, dataFlowTask, parentComponent, name, description) { _csCom = dataFlowTask.ComponentMetaDataCollection.New(); _csCom.ComponentClassID = "DTSTransform.ConditionalSplit"; //IMPORTANT! If you do not Instantiate() first, the component names do not get set... this is bad. _csi = _csCom.Instantiate(); _csi.ProvideComponentProperties(); _csCom.Name = Name; _csCom.Description = Description; _csCom.ValidateExternalMetadata = true; _csi.AcquireConnections(null); _csi.ReinitializeMetaData(); _csi.ReleaseConnections(); dataFlowTask.PathCollection.New().AttachPathAndPropagateNotifications( parentComponent.OutputCollection[0], _csCom.InputCollection[0] ); IDTSVirtualInput90 vi = _csCom.InputCollection[0].GetVirtualInput(); foreach (IDTSVirtualInputColumn90 vic in vi.VirtualInputColumnCollection) { this.SetInputUsageType(vi, vic, DTSUsageType.UT_READONLY); } }
public DerivedColumns(Packages.VulcanPackage vulcanPackage, MainPipe dataFlowTask, IDTSComponentMetaData90 parentComponent, string name, string description) : base( vulcanPackage, dataFlowTask, parentComponent, name, description ) { _dcCom = dataFlowTask.ComponentMetaDataCollection.New(); _dcCom.ComponentClassID = "DTSTransform.DerivedColumn"; //IMPORTANT! If you do not Instantiate() first, the component names do not get set... this is bad. _dci = _dcCom.Instantiate(); _dci.ProvideComponentProperties(); _dcCom.Name = Name; _dcCom.Description = Description; dataFlowTask.PathCollection.New().AttachPathAndPropagateNotifications( parentComponent.OutputCollection[0], _dcCom.InputCollection[0] ); _dci.AcquireConnections(null); _dci.ReinitializeMetaData(); _dci.ReleaseConnections(); }
public IDTSComponentMetaData100 AddComp_RowCount(string ComponentName, string VarName, IDTSOutput100 outCols ) { // Create IDTSComponentMetaData100 Comp = dmp.ComponentMetaDataCollection.New(); Comp.ComponentClassID = "Microsoft.RowCount"; // Instantiate CManagedComponentWrapper Inst = Comp.Instantiate(); Inst.ProvideComponentProperties(); Comp.Name = ComponentName; Comp.Description = "zliczanie wierszy"; // Parametrize Inst.SetComponentProperty("VariableName", VarName); // Connect IDTSPath100 pth = dmp.PathCollection.New(); pth.AttachPathAndPropagateNotifications(outCols, Comp.InputCollection[0]); // Return return(Comp); }
public void TestOutputColumn_Timecode_Missing() { Microsoft.SqlServer.Dts.Runtime.Package package = new Microsoft.SqlServer.Dts.Runtime.Package(); Executable exec = package.Executables.Add("STOCK:PipelineTask"); Microsoft.SqlServer.Dts.Runtime.TaskHost thMainPipe = exec as Microsoft.SqlServer.Dts.Runtime.TaskHost; MainPipe dataFlowTask = thMainPipe.InnerObject as MainPipe; ComponentEventHandler events = new ComponentEventHandler(); dataFlowTask.Events = DtsConvert.GetExtendedInterface(events as IDTSComponentEvents); IDTSComponentMetaData100 speechToText = dataFlowTask.ComponentMetaDataCollection.New(); speechToText.ComponentClassID = typeof(Martin.SQLServer.Dts.SSISSpeechToText).AssemblyQualifiedName; CManagedComponentWrapper speechToTextInstance = speechToText.Instantiate(); speechToTextInstance.ProvideComponentProperties(); speechToText.CustomPropertyCollection[Utility.SubscriptionKeyPropName].Value = "NotTheDefault"; // Before this is default setup for a clean component speechToText.OutputCollection[0].OutputColumnCollection.RemoveObjectByID(speechToText.OutputCollection[0].OutputColumnCollection[Utility.OutputTimecodeColumnName].ID); IDTSOutputColumn100 tempCol = speechToText.OutputCollection[0].OutputColumnCollection.New(); tempCol.Name = "TempCol"; tempCol.SetDataTypeProperties(DataType.DT_STR, 10, 0, 0, 1252); DTSValidationStatus actual = speechToTextInstance.Validate(); DTSValidationStatus expected = DTSValidationStatus.VS_ISCORRUPT; Assert.AreEqual(expected, actual); Assert.AreEqual("[Error] SSIS Speech To Text: Required Output Column Timecode is missing.", events.errorMessages[0]); }
public RabbitMQSourceUIForm(Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSComponentMetaData100 metaData, IServiceProvider serviceProvider) : this() { this.metaData = metaData; this.serviceProvider = serviceProvider; this.connectionService = (IDtsConnectionService)serviceProvider.GetService(typeof(IDtsConnectionService)); this.designTimeInstance = metaData.Instantiate(); }
public HDFSDestinationFormUI(IDTSComponentMetaData100 metaData, IServiceProvider serviceProvider) : this() { this.metaData = metaData; this.serviceProvider = serviceProvider; this.connectionService = (IDtsConnectionService)serviceProvider.GetService(typeof(IDtsConnectionService)); this.designTimeInstance = metaData.Instantiate(); }
public CRMDestinationAdapterUIForm(Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSComponentMetaData100 metaData, IDtsConnectionService connectionService) : this() { this.metaData = metaData; this.connectionService = connectionService; this.designTimeInstance = metaData.Instantiate(); }
public OLEDBCommand( VulcanPackage vulcanPackage, MainPipe dataFlowTask, IDTSComponentMetaData90 parentComponent, string name, string description, Connection connection, string command ) : base( vulcanPackage, dataFlowTask, parentComponent, name, description ) { _oledbCom = dataFlowTask.ComponentMetaDataCollection.New(); _oledbCom.ComponentClassID = "DTSTransform.OLEDBCommand"; //IMPORTANT! If you do not Instantiate() first, the component names do not get set... this is bad. _oledbComI = _oledbCom.Instantiate(); _oledbComI.ProvideComponentProperties(); _oledbCom.Name = name; _oledbCom.Description = description; _oledbCom.RuntimeConnectionCollection[0].ConnectionManagerID = connection.ConnectionManager.ID; _oledbCom.RuntimeConnectionCollection[0].ConnectionManager = DTS.DtsConvert.ToConnectionManager90(connection.ConnectionManager); _oledbComI.SetComponentProperty("SqlCommand", command); dataFlowTask.PathCollection.New().AttachPathAndPropagateNotifications( parentComponent.OutputCollection[0], _oledbCom.InputCollection[0] ); try { _oledbComI.AcquireConnections(null); _oledbComI.ReinitializeMetaData(); _oledbComI.ReleaseConnections(); } catch (System.Runtime.InteropServices.COMException ce) { Message.Trace(Severity.Error, ce, "OLEDBCommand: {3}: {2}: Source {0}: Command {1}", connection.ConnectionManager.Name, command, ce.Message, _oledbCom.GetErrorDescription(ce.ErrorCode)); } catch (Exception e) { Message.Trace(Severity.Error, e, "OLEDBCommand: {2}: Source {0}: Command {1}", connection.ConnectionManager.Name, command, e.Message); } AutoMap(); }
public IDTSComponentMetaData100 AddComp_Sort(string ComponentName, IDTSOutput100 outCols, Dictionary <string, bool> sortColumns ) { // Create IDTSComponentMetaData100 Comp = dmp.ComponentMetaDataCollection.New(); Comp.ComponentClassID = "Microsoft.Sort"; // Instantiate CManagedComponentWrapper Inst = Comp.Instantiate(); Inst.ProvideComponentProperties(); Comp.Name = ComponentName; Comp.Description = "Dodany Sort"; // Connect IDTSPath100 pth = dmp.PathCollection.New(); pth.AttachPathAndPropagateNotifications(outCols, Comp.InputCollection[0]); // Parametrize IDTSInput100 lkpInput = Comp.InputCollection[0]; IDTSInputColumnCollection100 lkpInputCols = lkpInput.InputColumnCollection; IDTSVirtualInput100 lkpVirtInput = lkpInput.GetVirtualInput(); IDTSVirtualInputColumnCollection100 lkpVirtInputCols = lkpVirtInput.VirtualInputColumnCollection; // Parametrize #2 - Join Columns int i = 1; foreach (IDTSVirtualInputColumn100 vColumn in lkpVirtInputCols) { IDTSInputColumn100 inputColumn = Inst.SetUsageType(lkpInput.ID, lkpVirtInput, vColumn.LineageID, DTSUsageType.UT_READONLY); foreach (var colKVP in sortColumns) { if (vColumn.Name == colKVP.Key) { Inst.SetInputColumnProperty(lkpInput.ID, inputColumn.ID, "NewComparisonFlags", 0); Inst.SetInputColumnProperty(lkpInput.ID, inputColumn.ID, "NewSortKeyPosition", colKVP.Value ? i: -i); i++; } } } // Return return(Comp); }
public OLEDBCommand( VulcanPackage vulcanPackage, MainPipe dataFlowTask, IDTSComponentMetaData90 parentComponent, string name, string description, Connection connection, string command ) : base(vulcanPackage, dataFlowTask, parentComponent, name, description) { _oledbCom = dataFlowTask.ComponentMetaDataCollection.New(); _oledbCom.ComponentClassID = "DTSTransform.OLEDBCommand"; //IMPORTANT! If you do not Instantiate() first, the component names do not get set... this is bad. _oledbComI = _oledbCom.Instantiate(); _oledbComI.ProvideComponentProperties(); _oledbCom.Name = name; _oledbCom.Description = description; _oledbCom.RuntimeConnectionCollection[0].ConnectionManagerID = connection.ConnectionManager.ID; _oledbCom.RuntimeConnectionCollection[0].ConnectionManager = DTS.DtsConvert.ToConnectionManager90(connection.ConnectionManager); _oledbComI.SetComponentProperty("SqlCommand", command); dataFlowTask.PathCollection.New().AttachPathAndPropagateNotifications( parentComponent.OutputCollection[0], _oledbCom.InputCollection[0] ); try { _oledbComI.AcquireConnections(null); _oledbComI.ReinitializeMetaData(); _oledbComI.ReleaseConnections(); } catch (System.Runtime.InteropServices.COMException ce) { Message.Trace(Severity.Error,ce,"OLEDBCommand: {3}: {2}: Source {0}: Command {1}", connection.ConnectionManager.Name, command, ce.Message, _oledbCom.GetErrorDescription(ce.ErrorCode)); } catch (Exception e) { Message.Trace(Severity.Error,e,"OLEDBCommand: {2}: Source {0}: Command {1}", connection.ConnectionManager.Name, command, e.Message); } AutoMap(); }
public TermLookup( VulcanPackage vulcanPackage, MainPipe dataFlowTask, IDTSComponentMetaData90 parentComponent, string name, string description, Connection connection, bool isCaseSensitive, string refTermColumn, string refTermTable ) : base(vulcanPackage, dataFlowTask, parentComponent, name, description) { TermLookupCom = dataFlowTask.ComponentMetaDataCollection.New(); TermLookupCom.ComponentClassID = "DTSTransform.TermLookup"; TermLookupComI = TermLookupCom.Instantiate(); TermLookupComI.ProvideComponentProperties(); TermLookupCom.Name = name; TermLookupCom.RuntimeConnectionCollection[0].ConnectionManagerID = connection.ConnectionManager.ID; TermLookupCom.RuntimeConnectionCollection[0].ConnectionManager = DTS.DtsConvert.ToConnectionManager90(connection.ConnectionManager); TermLookupComI.SetComponentProperty("IsCaseSensitive", isCaseSensitive); TermLookupComI.SetComponentProperty("RefTermColumn", refTermColumn); TermLookupComI.SetComponentProperty("RefTermTable", refTermTable); TermLookupCom.OutputCollection[0].ErrorRowDisposition = DTSRowDisposition.RD_IgnoreFailure; dataFlowTask.PathCollection.New().AttachPathAndPropagateNotifications( parentComponent.OutputCollection[0], TermLookupCom.InputCollection[0] ); TermLookupComI.AcquireConnections(null); TermLookupComI.ReinitializeMetaData(); TermLookupComI.ReleaseConnections(); }
public SsisComponent(Transformation transformation, SSISEmitterContext context) { if (!context.HasSSISDataFlowTask) { // TODO: Message.Trace(Severity.Error) } _transformation = transformation; _dataFlowTask = context.SSISDataFlowTask; _context = context; _component = _dataFlowTask.NewComponentMetaData(); _component.ComponentClassID = ClassID; _instance = _component.Instantiate(); _instance.ProvideComponentProperties(); _component.Name = _transformation.Name; _component.ValidateExternalMetadata = transformation.ValidateExternalMetadata; }
public Lookup( VulcanPackage vulcanPackage, MainPipe dataFlowTask, IDTSComponentMetaData90 parentComponent, string name, string description, Connection connection, string query ) : base(vulcanPackage, dataFlowTask, parentComponent, name, description) { lookupCom = dataFlowTask.ComponentMetaDataCollection.New(); lookupCom.ComponentClassID = "DTSTransform.Lookup"; lookupComI = lookupCom.Instantiate(); lookupComI.ProvideComponentProperties(); lookupCom.Name = name; lookupCom.RuntimeConnectionCollection[0].ConnectionManagerID = connection.ConnectionManager.ID; lookupCom.RuntimeConnectionCollection[0].ConnectionManager = DTS.DtsConvert.ToConnectionManager90(connection.ConnectionManager); lookupComI.SetComponentProperty("SqlCommand", query); lookupCom.OutputCollection[0].ErrorRowDisposition = DTSRowDisposition.RD_IgnoreFailure; dataFlowTask.PathCollection.New().AttachPathAndPropagateNotifications( parentComponent.OutputCollection[0], lookupCom.InputCollection[0] ); lookupComI.AcquireConnections(null); lookupComI.ReinitializeMetaData(); lookupComI.ReleaseConnections(); }
public Sort( VulcanPackage vulcanPackage, MainPipe dataFlowTask, IDTSComponentMetaData90 parentComponent, string name, string description, bool eliminateDuplicates, int maximumThreads ) : base(vulcanPackage, dataFlowTask, parentComponent, name, description) { _sortOrder = 1; _sortCom = dataFlowTask.ComponentMetaDataCollection.New(); _sortCom.ComponentClassID = "DTSTransform.sort"; _sortComI = _sortCom.Instantiate(); _sortComI.ProvideComponentProperties(); _sortCom.Name = name; _sortComI.SetComponentProperty("EliminateDuplicates", eliminateDuplicates); _sortComI.SetComponentProperty("MaximumThreads", maximumThreads); _sortCom.OutputCollection[0].ErrorRowDisposition = DTSRowDisposition.RD_NotUsed; dataFlowTask.PathCollection.New().AttachPathAndPropagateNotifications( parentComponent.OutputCollection[0], _sortCom.InputCollection[0] ); _sortComI.AcquireConnections(null); _sortComI.ReinitializeMetaData(); _sortComI.ReleaseConnections(); }
public OLEDBDestination( Packages.VulcanPackage vulcanPackage, MainPipe dataFlowTask, IDTSComponentMetaData90 parentComponent, string name, string description, Connection connection, string tableName ) : base(vulcanPackage, dataFlowTask, parentComponent, name, description) { //remove duplicates if you happen to enclose the table in brackets :) _oledbDest = dataFlowTask.ComponentMetaDataCollection.New(); _oledbDest.ComponentClassID = "DTSAdapter.OleDbDestination.1"; _oledbDestI = _oledbDest.Instantiate(); _oledbDestI.ProvideComponentProperties(); _oledbDest.Name = Resources.OLEDBDestinationNamePrefix + (tableName.Replace("[", "").Replace("]", "").Replace("dbo", "").Replace(".","")); _oledbDest.ValidateExternalMetadata = true; _oledbDest.RuntimeConnectionCollection[0].ConnectionManager = DTS.DtsConvert.ToConnectionManager90( connection.ConnectionManager ); _oledbDest.RuntimeConnectionCollection[0].ConnectionManagerID = connection.ConnectionManager.ID; dataFlowTask.PathCollection.New().AttachPathAndPropagateNotifications( parentComponent.OutputCollection[0], _oledbDest.InputCollection[0] ); }
public UnionAll( VulcanPackage vulcanPackage, MainPipe dataFlowTask, IDTSComponentMetaData90 parentComponent, string name, string description ) : base(vulcanPackage, dataFlowTask, parentComponent, name, description) { unionAllCom = dataFlowTask.ComponentMetaDataCollection.New(); unionAllCom.ComponentClassID = "DTSTransform.UnionAll"; unionAllComI = unionAllCom.Instantiate(); unionAllComI.ProvideComponentProperties(); unionAllCom.Name = name; unionAllCom.OutputCollection[0].ErrorRowDisposition = DTSRowDisposition.RD_NotUsed; }
internal BipsProxyCManagedComponentWrapper(CManagedComponentWrapper innerObject) { _innerObject = innerObject; }