Example #1
0
        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);
        }
Example #2
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();
 }
Example #3
0
 public static void SetSQLSource(this CManagedComponentWrapper InstanceSource, string SQLStatementSource, bool SQLStatementASVariable)
 {
     if (SQLStatementASVariable)
     {
         InstanceSource.SetComponentProperty("AccessMode", 3);
         InstanceSource.SetComponentProperty("SqlCommandVariable", SQLStatementSource);
     }
     else
     {
         InstanceSource.SetComponentProperty("AccessMode", 2);
         InstanceSource.SetComponentProperty("SqlCommand", SQLStatementSource);
     }
 }
Example #4
0
        public static void SetTableDestination(this CManagedComponentWrapper InstanceDestination, string TableName)
        {
            InstanceDestination.SetComponentProperty("OpenRowset", TableName);
            InstanceDestination.SetComponentProperty("AccessMode", 3);
            InstanceDestination.SetComponentProperty("FastLoadOptions", "TABLOCK");
            //TODO: Can be set using config
            InstanceDestination.SetComponentProperty("FastLoadMaxInsertCommitSize", 10000);

            InstanceDestination.SetComponentProperty("FastLoadKeepNulls", false);
            InstanceDestination.SetComponentProperty("FastLoadKeepIdentity", false);
            InstanceDestination.SetComponentProperty("DefaultCodePage", 1252);
            InstanceDestination.SetComponentProperty("CommandTimeout", 0);
            InstanceDestination.SetComponentProperty("AlwaysUseDefaultCodePage", false);
            InstanceDestination.SetComponentProperty("FastLoadKeepIdentity", false);
        }
        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);
        }
Example #6
0
        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);
        }
Example #7
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            designTimeInstance.SetComponentProperty("url", txtURL.Text);
            designTimeInstance.SetComponentProperty("bucket", txtBucket.Text);
            designTimeInstance.SetComponentProperty("password", txtPassword.Text);
            designTimeInstance.SetComponentProperty("designDoc", txtDesignDoc.Text);
            designTimeInstance.SetComponentProperty("view", txtView.Text);
            designTimeInstance.SetComponentProperty("forceReindex", cbForceReindex.Checked);
            designTimeInstance.SetComponentProperty("descending", cbDescending.Checked);
            designTimeInstance.SetComponentProperty("startKey", txtStartKey.Text);
            designTimeInstance.SetComponentProperty("endKey", txtEndKey.Text);

            designTimeInstance.SetComponentProperty("modelXML", model.GetXml());

            this.Close();
        }
        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 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);
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (cbConnectionList.SelectedItem != null)
            {
                var item = (ConnectionManagerItem)cbConnectionList.SelectedItem;


                this.metaData.RuntimeConnectionCollection[0].Description         = "Dynamics CRM Connection";
                this.metaData.RuntimeConnectionCollection[0].ConnectionManagerID = item.ID;
                this.metaData.RuntimeConnectionCollection[0].Name = item.Name;
            }

            if (txtFetchXML.Text.Trim() != oldFetchXML)
            {
                this.metaData.OutputCollection[0].OutputColumnCollection.RemoveAll(); //Force update Outputs Columns
            }

            if (!string.IsNullOrWhiteSpace(txtFetchXML.Text))
            {
                designTimeInstance.SetComponentProperty("FetchXML", txtFetchXML.Text.Trim());
            }



            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }
        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.
        }
Example #13
0
        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 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 override IDTSComponentMetaData100 Initialize()
        {
            // Create custom PartitionFunction component
            IDTSComponentMetaData100 comp = base.Initialize();

            CManagedComponentWrapper dcomp = comp.Instantiate();

            //set Partition Function
            dcomp.SetComponentProperty("PartitionFunction", PartitionFunction(_src.Partition.Function));
            dcomp.SetComponentProperty("PartitionFunctionOutput", _src.Partition.Output);


            // Finalize
            Reinitialize(dcomp);
            return(comp);
        }
Example #16
0
        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();
        }
Example #17
0
        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();
        }
Example #18
0
        // Create row count component
        public SSISRowCount(MainPipe pipe, IDTSComponentMetaData100 src)
            : base(pipe, "Row Count")
        {
            CManagedComponentWrapper dcomp = this.MetadataCollection.Instantiate();

            dcomp.SetComponentProperty("VariableName", "RowCount");
            this.Reinitialize(dcomp);
            this.ConnectComponents(src);
        }
        public override IDTSComponentMetaData100 Initialize()
        {
            // Create rowcount component
            IDTSComponentMetaData100 comp  = base.Initialize();
            CManagedComponentWrapper dcomp = comp.Instantiate();

            dcomp.SetComponentProperty("VariableName", "RowCount");
            this.Reinitialize(dcomp);
            return(comp);
        }
        public SSISPartitionColumn(MainPipe pipe, IDTSComponentMetaData100 src, MoveData parameters)
            : base(pipe, "PartitionData", 0, "Microsoft.AdCenter.Jazz.PartitionData, PartitionData, Version=1.0.0.1, Culture=neutral, PublicKeyToken=5783f99a1329d562")
        {
            // Create custom PartitionFunction component

            IDTSComponentMetaData100 comp  = this.MetadataCollection;
            CManagedComponentWrapper dcomp = comp.Instantiate();

            //set Partition Function
            dcomp.SetComponentProperty("PartitionFunction", PartitionFunction(parameters.Partition.Function));
            dcomp.SetComponentProperty("PartitionFunctionOutput", parameters.Partition.Output);


            // Finalize
            this.Reinitialize(dcomp);
            this.ConnectComponents(src);

            //add partitionfunction input
            SetPartitionFunctionInput(parameters.Partition.Input);
        }
Example #21
0
        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();
        }
Example #22
0
        public override IDTSComponentMetaData100 Initialize()
        {
            //create Ado Net destination component
            IDTSComponentMetaData100 comp = base.Initialize();

            //set connection properties
            _cm.Name             = $"AdoNet Destination Connection Manager {comp.ID}";
            _cm.ConnectionString = _dst.ConnectionString;
            _cm.Description      = _dst.Description;
            if (!String.IsNullOrEmpty(_dst.DBConnection.Qualifier))
            {
                _cm.Qualifier = _dst.DBConnection.Qualifier;
            }

            CManagedComponentWrapper dcomp = comp.Instantiate();

            // Set AdoNet destination custom properties
            foreach (KeyValuePair <string, object> prop in _dst.CustomProperties.CustomPropertyCollection.InnerArrayList)
            {
                dcomp.SetComponentProperty(prop.Key, prop.Value);
            }

            //default - OpenRowset; ovveride OpenRowset with stagingtablename if staging is used
            if (!(_dst.StagingBlock == null) && _dst.StagingBlock.Staging)
            {
                dcomp.SetComponentProperty("TableOrViewName", _dst.StagingBlock.StagingTableName.RemoveQuotes());
            }
            else
            {
                dcomp.SetComponentProperty("TableOrViewName", _dst.CustomProperties.TableOrViewName.RemoveQuotes());
            }

            if (comp.RuntimeConnectionCollection.Count > 0)
            {
                comp.RuntimeConnectionCollection[0].ConnectionManagerID = _cm.ID;
                comp.RuntimeConnectionCollection[0].ConnectionManager   = DtsConvert.GetExtendedInterface(_cm);
            }

            this.Reinitialize(dcomp);
            return(comp);
        }
Example #23
0
        public CManagedComponentWrapper AddRowCount(MainPipe dataFlow, string Name, out IDTSComponentMetaData100 rowCount, string variableName)
        {
            // Add Row Count transform
            rowCount = dataFlow.AddPipeLine(SSISMoniker.ROW_COUNT, Name + " RC");
            CManagedComponentWrapper instance = rowCount.InitializeTask();

            rowCount.Name = Name + "RC";
            // Set the variable name property
            instance.SetComponentProperty("VariableName", variableName);

            return(instance);
        }
        public IDTSComponentMetaData100 AddComp_AttunitySource(string componentName,
                                                               string conManName,
                                                               string source
                                                               )
        {
            //  Create

            IDTSComponentMetaData100 Comp = dmp.ComponentMetaDataCollection.New();

            Comp.ComponentClassID = "Attunity.SSISOraSrc";

            //  Instantiate

            CManagedComponentWrapper Inst = Comp.Instantiate();

            Inst.ProvideComponentProperties();

            Comp.Name        = componentName;
            Comp.Description = "Attunity Source Component";

            Inst.SetComponentProperty("AccessMode", 0);
            Inst.SetComponentProperty("TableName", source);

            //  GetConnectionManager

            ConnectionManager cm = prj.ConnectionManagerItems[conManName + ".conmgr"].ConnectionManager;

            ////  Parametrize

            Comp.RuntimeConnectionCollection[0].ConnectionManager   = DtsConvert.GetExtendedInterface(cm);
            Comp.RuntimeConnectionCollection[0].ConnectionManagerID = cm.ID;

            Inst.AcquireConnections(null);  //  Establishes a connection to a connection manager
            Inst.ReinitializeMetaData();    //  Called to allow the component to repair problems with the IDTSComponentMetaData100 object that were identified by the component during the Validate() method.
            Inst.ReleaseConnections();      //  Frees the connections established by the component during AcquireConnections(Object).

            //  Return

            return(Comp);
        }
        public override IDTSComponentMetaData100 Initialize()
        {
            //create oledb destination component
            IDTSComponentMetaData100 comp = base.Initialize();

            //set connection properties
            _cm.Name             = $"OleDb Destination Connection Manager {comp.ID}";
            _cm.ConnectionString = _dst.ConnectionString;
            _cm.Description      = _dst.Description;

            CManagedComponentWrapper dcomp = comp.Instantiate();

            // Set oledb destination custom properties
            //default to openrowset fastload
            dcomp.SetComponentProperty("AccessMode", 3);
            //foreach (KeyValuePair<string, object> prop in dbdst.CustomProperties.CustomPropertyCollection.InnerArrayList)
            foreach (KeyValuePair <string, object> prop in _dst.CustomProperties.CustomPropertyCollection.InnerArrayList)
            {
                dcomp.SetComponentProperty(prop.Key, prop.Value);
            }

            //default - OpenRowset; ovveride OpenRowset with stagingtablename if staging is used
            if (!(_dst.StagingBlock == null) && _dst.StagingBlock.Staging)
            {
                dcomp.SetComponentProperty("OpenRowset", _dst.StagingBlock.StagingTableName.RemoveQuotes());
            }
            else
            {
                dcomp.SetComponentProperty("OpenRowset", _dst.TableName.RemoveQuotes());
            }

            if (comp.RuntimeConnectionCollection.Count > 0)
            {
                comp.RuntimeConnectionCollection[0].ConnectionManagerID = _cm.ID;
                comp.RuntimeConnectionCollection[0].ConnectionManager   = DtsConvert.GetExtendedInterface(_cm);
            }

            this.Reinitialize(dcomp);
            return(comp);
        }
Example #26
0
        public SSISFlatFileDestination(FlatFileDestination fdst, MainPipe pipe, IDTSComponentMetaData100 src, int outputID, ConnectionManager cm)
            : base(pipe, "Flat File Destination", outputID)
        {
            cm.Name = String.Format(CultureInfo.InvariantCulture, "FlatFile Destination Connection Manager {0}", outputID);

            //Create a new FlatFileDestination component

            IDTSComponentMetaData100 comp  = this.MetadataCollection;
            CManagedComponentWrapper dcomp = comp.Instantiate();

            foreach (KeyValuePair <string, object> prop in fdst.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);

            //Create datatype converter if needed
            Dictionary <string, int> converted = new Dictionary <string, int>();
            IDTSVirtualInput100      vInput    = src.InputCollection[0].GetVirtualInput();

            if (this.needDataTypeChange(vInput, comp.InputCollection[0]))
            {
                //create the destination column collection
                Dictionary <string, MyColumn> exColumns = new Dictionary <string, MyColumn>();
                foreach (IDTSExternalMetadataColumn100 exColumn in comp.InputCollection[0].ExternalMetadataColumnCollection)
                {
                    MyColumn col = new MyColumn();
                    col.Name      = exColumn.Name;
                    col.DataType  = exColumn.DataType;
                    col.Length    = exColumn.Length;
                    col.Precision = exColumn.Precision;
                    col.Scale     = exColumn.Scale;
                    col.CodePage  = exColumn.CodePage;
                    exColumns.Add(exColumn.Name, col);
                }
                SSISDataConverter ssisdc = new SSISDataConverter(pipe, src, outputID, exColumns);
                src       = ssisdc.MetadataCollection;
                converted = ssisdc.ConvertedColumns;
                outputID  = 0;
            }

            this.ConnectComponents(src, outputID);
            this.MatchInputColumns(converted, false);
        }
Example #27
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(txtDestinationPath.Text))
            {
                designTimeInstance.SetComponentProperty(Constants.HDFS_PATH_PROPERTY, txtDestinationPath.Text);
            }

            if (cbConnectionList.SelectedItem != null)
            {
                var item = (ConnectionManagerItem)cbConnectionList.SelectedItem;
                this.metaData.RuntimeConnectionCollection[0].ConnectionManagerID = item.ID;
            }

            if (cbSourceColumns.SelectedItem != null)
            {
                var item = (SourceColumnItem)cbSourceColumns.SelectedItem;
                designTimeInstance.SetComponentProperty(Constants.SOURCE_COLUMN_INDEX, item.Index);
            }

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            this.Close();
        }
Example #28
0
        public SSISSharePointSource(SharePointSource spsrc, MainPipe pipe)
            : base(pipe, "SharePoint List Source", 0, "Microsoft.Samples.SqlServer.SSIS.SharePointListAdapters.SharePointListSource, SharePointListAdapters, Version=1.2016.0.0, Culture=neutral, PublicKeyToken=f4b3011e1ece9d47")
        {
            IDTSComponentMetaData100 comp  = this.MetadataCollection;
            CManagedComponentWrapper dcomp = comp.Instantiate();

            // Set SP custom properties
            foreach (KeyValuePair <string, object> prop in spsrc.CustomProperties.CustomPropertyCollection.InnerArrayList)
            {
                dcomp.SetComponentProperty(prop.Key, prop.Value);
            }

            this.Reinitialize(dcomp);
        }
        public override IDTSComponentMetaData100 Initialize()
        {
            //create excel destination component
            IDTSComponentMetaData100 comp = base.Initialize();

            //set connection properties
            _cm.Name             = $"Excel Destination Connection Manager {comp.ID}";
            _cm.ConnectionString = _dst.ConnectionString;
            _cm.Description      = _dst.Description;


            //mwrt.IDTSConnectionManagerExcel100 ecm = cm.InnerObject as mwrt.IDTSConnectionManagerExcel100;
            //ecm.ExcelFilePath = dbdst.FilePath;
            //ecm.FirstRowHasColumnName = dbdst.Header;
            //ecm.ExcelVersionNumber = mwrt.DTSExcelVersion.DTSExcelVer_2007;


            CManagedComponentWrapper dcomp = comp.Instantiate();

            // Set oledb destination custom properties
            //default to openrowset
            dcomp.SetComponentProperty("AccessMode", 0);
            //foreach (KeyValuePair<string, object> prop in dbdst.CustomProperties.CustomPropertyCollection.InnerArrayList)
            foreach (KeyValuePair <string, object> prop in _dst.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);
            }

            this.Reinitialize(dcomp);
            return(comp);
        }
Example #30
0
        public override IDTSComponentMetaData100 Initialize()
        {
            //create SharePoint destination component
            IDTSComponentMetaData100 comp = base.Initialize();

            CManagedComponentWrapper dcomp = comp.Instantiate();

            foreach (KeyValuePair <string, object> prop in _dst.CustomProperties.CustomPropertyCollection.InnerArrayList)
            {
                dcomp.SetComponentProperty(prop.Key, prop.Value);
            }

            this.Reinitialize(dcomp);
            return(comp);
        }
Example #31
0
File: Sort.cs Project: japj/vulcan
        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();
        }
Example #32
0
        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();
        }
Example #33
0
        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();
        }
Example #34
0
        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();
        }