Example #1
0
        public static void CustomizeComponentProperties(IDTSComponentMetaData100 componentMetaData)
        {
            //add IsIdentifier property to input columns
            IDTSInput100 input = componentMetaData.InputCollection[0];
            foreach (IDTSInputColumn100 column in input.InputColumnCollection)
            {
                AddColumnIsIdentifierProperty(column);
            }

            //add output columns
            IDTSOutput100 output = componentMetaData.OutputCollection[0];
            AddOutputColumn(output, "TableName", DataType.DT_WSTR, 255, 0, 0, 0);
            AddOutputColumn(output, "ColumnNameList", DataType.DT_WSTR, 4000, 0, 0, 0);
            AddOutputColumn(output, "ColumnValueList", DataType.DT_WSTR, 4000, 0, 0, 0);
            AddOutputColumn(output, "IdentifierCondition", DataType.DT_WSTR, 4000, 0, 0, 0);
            AddOutputColumn(output, "ExceptionLevel", DataType.DT_WSTR, 20, 0, 0, 0);
            AddOutputColumn(output, "StartTime", DataType.DT_DBTIMESTAMP, 0, 0, 0, 0);
            AddOutputColumn(output, "PackageName", DataType.DT_WSTR, 255, 0, 0, 0);
            AddOutputColumn(output, "TaskName", DataType.DT_WSTR, 255, 0, 0, 0);
            AddOutputColumn(output, "ComponentName", DataType.DT_WSTR, 255, 0, 0, 0);
            AddOutputColumn(output, "ErrorCode", DataType.DT_I4, 0, 0, 0, 0);
            AddOutputColumn(output, "ErrorDescription", DataType.DT_WSTR, 1000, 0, 0, 0);
            AddOutputColumn(output, "ErrorColumn", DataType.DT_I4, 0, 0, 0, 0);
            AddOutputColumn(output, "ErrorColumnName", DataType.DT_WSTR, 255, 0, 0, 0);
        }
Example #2
0
        public void Initialize(IDTSComponentMetaData100 dtsComponentMetadata, IServiceProvider serviceProvider)
        {
            this.serviceProvider = serviceProvider;
              this.metaData = dtsComponentMetadata;

              this.connectionService = (IDtsConnectionService)serviceProvider.GetService(typeof(IDtsConnectionService));
        }
Example #3
0
        public void Initialize(Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSComponentMetaData100 dtsComponentMetadata, IServiceProvider serviceProvider)
        {
            this.serviceProvider = serviceProvider;
              this.metaData = dtsComponentMetadata;

              this.connectionService = (IDtsConnectionService)serviceProvider.GetService(typeof(IDtsConnectionService));
        }
 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 void Initialize(IDTSComponentMetaData100 dtsComponentMetadata, IServiceProvider serviceProvider)
        {
            ArgumentVerifier.CheckObjectArgument(dtsComponentMetadata, "componentMetadata");
            ArgumentVerifier.CheckObjectArgument(serviceProvider, "serviceProvider");

            this.componentMetadata = dtsComponentMetadata;
            this.serviceProvider = serviceProvider;

            this.connService = this.serviceProvider.GetService(typeof(Microsoft.SqlServer.Dts.Runtime.Design.IDtsConnectionService)) as Microsoft.SqlServer.Dts.Runtime.Design.IDtsConnectionService;
        }
		public __ComponentMetadataWrapper(IDTSComponentMetaData100 dtsComponentMetaData100, Func<IUnitOfWork> dictionaryUnitOfWorkCallback)
			: base((object)dtsComponentMetaData100 == null ? null : dtsComponentMetaData100.CustomPropertyCollection)
		{
			if ((object)dtsComponentMetaData100 == null)
				throw new ArgumentNullException("dtsComponentMetaData100");

			if ((object)dictionaryUnitOfWorkCallback == null)
				throw new ArgumentNullException("dictionaryUnitOfWorkCallback");

			this.dtsComponentMetaData100 = dtsComponentMetaData100;
			this.dictionaryUnitOfWorkCallback = dictionaryUnitOfWorkCallback;
		}
Example #7
0
        public ReverseStringUIForm(IDTSComponentMetaData100 dtsComponentMetaData, IServiceProvider serviceProvider, Connections connections)
        {
            InitializeComponent();

            // Store constructor parameters for later
            _dtsComponentMetaData = dtsComponentMetaData;

            // Get design-time interface for changes and validation
            _designTimeComponent = _dtsComponentMetaData.Instantiate();

            // Get Input
            _input = _dtsComponentMetaData.InputCollection[0];

            // Set any form controls that host component properties here
            // None required for ReverseString component

            // Populate DataGridView with columns
            SetInputVirtualInputColumns();

            _connections = connections;
            // Get IDtsConnectionService and store.
            IDtsConnectionService dtsConnectionService = serviceProvider.GetService(typeof(IDtsConnectionService)) as IDtsConnectionService;
            _dtsConnectionService = dtsConnectionService;

            // Get Connections collection, and get name of currently selected connection.
            string connectionName = "";
            if (_dtsComponentMetaData.RuntimeConnectionCollection[0] != null)
            {
                IDTSRuntimeConnection100 runtimeConnection =
                      _dtsComponentMetaData.RuntimeConnectionCollection[0];
                if (runtimeConnection != null
                   && runtimeConnection.ConnectionManagerID.Length > 0
                   && _connections.Contains(runtimeConnection.ConnectionManagerID))
                {
                    connectionName = _connections[runtimeConnection.ConnectionManagerID].Name;
                }
            }

            // Populate connections combo.
            PopulateConnectionsCombo(this.cmbSqlConnections, Connection_Type,
               connectionName);
        }
Example #8
0
        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;
        }
        private void AddConvertComponent(Hashtable colConvertTable, Hashtable colConnectTable)
		{
			convertComp = pipeline.ComponentMetaDataCollection.New();
			convertComp.ComponentClassID = DATACONVERT_GUID;
			convertComp.Name = "Data Conversion";
			convertComp.ValidateExternalMetadata = true;
			convertDesignTimeComp = convertComp.Instantiate();
			convertDesignTimeComp.ProvideComponentProperties();
			IDTSInput100 cvtInput = convertComp.InputCollection[0];
			IDTSOutput100 cvtOutput = convertComp.OutputCollection[0];
			IDTSInputColumnCollection100 cvtInputCols = cvtInput.InputColumnCollection;
			IDTSOutput100 srcOutput = srcComp.OutputCollection[0];

			pipeline.PathCollection.New().AttachPathAndPropagateNotifications(srcOutput, cvtInput);
			IDTSVirtualInput100 cvtVirInput = cvtInput.GetVirtualInput();

			int i = 0;
			foreach (object key in colConvertTable.Keys)
			{
				int srcColID = (int)key;
				cvtVirInput.SetUsageType(srcColID, DTSUsageType.UT_READONLY);
				IDTSInputColumn100 cvtInputCol = cvtInputCols.GetInputColumnByLineageID(srcColID);
				if (cvtInputCol != null)
				{
					IDTSOutputColumn100 cvtOutputCol = convertDesignTimeComp.InsertOutputColumnAt(cvtOutput.ID, i++, "Convert_" + cvtInputCol.Name, "");
					IDTSExternalMetadataColumn100 destCol = (IDTSExternalMetadataColumn100)colConvertTable[key];
					convertDesignTimeComp.SetOutputColumnDataTypeProperties(cvtOutput.ID,
						cvtOutputCol.ID, destCol.DataType, destCol.Length, destCol.Precision, destCol.Scale, destCol.CodePage);
					// map output column and input column
					convertDesignTimeComp.SetOutputColumnProperty(cvtOutput.ID,
					cvtOutputCol.ID, "SourceInputColumnLineageID", srcColID);
					// add match table entry.
					colConnectTable.Add(cvtOutputCol.ID, destCol);
				}
			}
		}
Example #10
0
 public void Initialize(IDTSComponentMetaData100 dtsComponentMetadata, IServiceProvider serviceProvider)
 {
     this.ServiceProvider = serviceProvider;
 }
Example #11
0
 public void Initialize(IDTSComponentMetaData100 dtsComponentMetadata, IServiceProvider serviceProvider)
 {
     // Store ComponentMetaData for later use
     _dtsComponentMetaData = dtsComponentMetadata;
     _serviceProvider = serviceProvider;
 }
 public DataFlowComponentNodeFactory(IDTSComponentMetaData100 input, IDTSComponentMetaDataCollection100 metadata)
 {
     _input = input;
     _metadata = metadata;
 }
Example #13
0
 public void NewDataFlow()
 {
     _lastComponent = null;
 }
Example #14
0
 private static void InitializeComponent(IDTSComponentMetaData100 cmd, ConnectionManager cm)
 {
     try
     {
         CManagedComponentWrapper cmcw = cmd.Instantiate();
         cmd.RuntimeConnectionCollection[0].ConnectionManager = Microsoft.SqlServer.Dts.Runtime.DtsConvert.GetExtendedInterface(cm);
         cmd.RuntimeConnectionCollection[0].ConnectionManagerID = cm.ID;
         // aquire the runtime connection to the designtime instance of the component.
         cmcw.AcquireConnections(null);
         cmcw.ReinitializeMetaData();
         cmd.RemoveInvalidInputColumns();
         cmcw.ReleaseConnections();
     }
     catch (Exception e)
     {
         Console.WriteLine("There is a problem with the connection manager {0}", cm.Name);
         Console.WriteLine("More than likely it could not connect to the database and reinitialize the correct columns");
         Console.WriteLine("Make sure you have the ability to connect and that the connection managers in the template package are correct");
         Console.WriteLine("Error message is below:");
         Console.WriteLine(e.Message);
         System.Environment.Exit(0);
     }
 }
Example #15
0
 public void Instantiate(String bstrUserComponentTypeName, IDTSComponentMetaData100 pComponentMetaData,
     IDTSVariableDispenser100 pVariableDispenser, IDTSBufferManager100 pBufferManager,
     IDTSEventInfos100 pEventInfos, IDTSObjectReferenceTracker100 pRefTracker,
     IDTSLogEntryInfos100 pLogEntryInfos, out DTSProductLevel peProductLevel)
 {
     _innerObject.Instantiate(bstrUserComponentTypeName, pComponentMetaData, pVariableDispenser, pBufferManager,
         pEventInfos, pRefTracker, pLogEntryInfos, out peProductLevel);
 }
Example #16
0
 internal BipsProxyIDTSComponentMetaData100(IDTSComponentMetaData100 innerObject)
 {
     _innerObject = innerObject;
 }
Example #17
0
 public Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSBuffer100 Clone(IDTSComponentMetaData100 pOwner)
 {
     return _innerObject.Clone(pOwner);
 }
    public override void CreateNewOutputRows()
    {
        #region Set up verbose logging
        __metadata = ComponentMetaData;
        #endregion

        // See http://blogs.msdn.com/b/brian_jones/archive/2008/11/10/reading-data-from-spreadsheetml.aspx
        // http://openxmldeveloper.org/discussions/formats/f/14/p/5029/157797.aspx
        // http://blogs.msdn.com/b/ericwhite/archive/2010/07/21/table-markup-in-open-xml-spreadsheetml.aspx

        #region Configure Column Mapping
        this.MapColumns();
        if (this._columnMappings.Count != ComponentMetaData.OutputCollection[0].OutputColumnCollection.Count)
        {
            string message = this._columnMappings.Count.ToString() + " column relationships have been set up, but the Script Source has "
                + ComponentMetaData.OutputCollection[0].OutputColumnCollection.Count.ToString() + " output columns defined.";
            ReportError(message, true);
            throw new ArgumentException(message);
        }
        VerboseLog(this._columnMappings.Count.ToString() + " column mappings defined.");
        #endregion

        #region Extract Excel file name from connection manager
        string workbookFileName = null;
        SpreadsheetDocument document = null;
        try
        {
            VerboseLog("Extracting Excel file name from connection manager.");
            string connectionString = ComponentMetaData.RuntimeConnectionCollection[0].ConnectionManager.ConnectionString;
            string[] connectionStringParts = connectionString.Split(';');
            foreach (string connectionStringPart in connectionStringParts)
            {
                string[] pair = connectionStringPart.Split('=');
                if (pair[0] == "Data Source")
                {
                    workbookFileName = pair[1];
                    VerboseLog("File name of '" + workbookFileName + "' identified in connection manager.");
                    break;
                }
            }
        }
        #region catch ...
        catch (Exception ex)
        {
            ReportError("Unable to parse connection string: " + ex.Message, true);
        }
        #endregion
        #endregion
        #region Opening Excel file
        if (workbookFileName != null)
        {
            try
            {
                VerboseLog("Attempting to open Excel file.");
                document = SpreadsheetDocument.Open(workbookFileName, false);
            }
            #region catch ...
            catch (Exception ex)
            {
                ReportError("Unable to open '" + workbookFileName + "': " + ex.Message, true);
            }
            #endregion
        }
        VerboseLog("Excel file opened.");
        #endregion
        try
        {
            WorkbookPart workbook = document.WorkbookPart;
            SharedStringTablePart sharedStringTablePart = workbook.SharedStringTablePart;
            #region Unused code for finding ranges
            //ComponentMetaData.FireInformation(0, "", "Got WorkbookPart", "", 0, ref fireAgain);
            //#region Look at Ranges
            //bool foundRange = false;
            //RangeDef rangeDef = new RangeDef();
            //foreach (DefinedName name in workbook.Workbook.GetFirstChild<DefinedNames>())
            //{
            //    ComponentMetaData.FireInformation(0, "", "Looking at defined name '" + name.Name + "'", "", 0, ref fireAgain);
            //    if (name.Name == this._rangeName)
            //    {
            //        ComponentMetaData.FireInformation(0, "", "Saving def", "", 0, ref fireAgain);
            //        rangeDef.Name = name.Name;
            //        string reference = name.InnerText;
            //        ComponentMetaData.FireInformation(0, "", "  reference: " + reference, "", 0, ref fireAgain);
            //        rangeDef.Sheet = reference.Split('!')[0].Trim('\'');
            //        string[] rangeArray = reference.Split('!')[1].Split('$');
            //        rangeDef.StartCol = rangeArray[1];
            //        rangeDef.StartRow = rangeArray[2].TrimEnd(':');
            //        rangeDef.EndCol = rangeArray[3];
            //        rangeDef.EndRow = rangeArray[4];
            //        foundRange = true;
            //        break;
            //    }
            //}
            //ComponentMetaData.FireInformation(0, "", "Done looking for defined names", "", 0, ref fireAgain);
            //if (foundRange)
            //{
            //    string rangeID = workbook.Workbook.Descendants<Sheet>().Where(r => r.Name.Equals(rangeDef.Sheet)).First().Id;
            //    ComponentMetaData.FireInformation(0, "", "Got rangeID " + rangeID, "", 0, ref fireAgain);
            //    WorksheetPart range = (WorksheetPart)workbook.GetPartById(rangeID);
            //    ComponentMetaData.FireInformation(0, "", "Got Range", "", 0, ref fireAgain);
            //}
            //#endregion
            #endregion
            #region Iterate over sheets to find table
            // VerboseLog("Searching sheets for table '" + ExcelTableName + "'.");
            VerboseLog("Searching for sheet '" + ExcelSheetName + "'.");
            // Table table = null;
            Worksheet worksheet = null;
            foreach (Sheet sheet in workbook.Workbook.Sheets)
            {
                VerboseLog("Examining sheet '" + sheet.Name + "'.");
                WorksheetPart worksheetPart = (WorksheetPart)document.WorkbookPart.GetPartById(sheet.Id);
                if (sheet.Name == ExcelSheetName)
                {
                    worksheet = worksheetPart.Worksheet;
                    VerboseLog("Sheet found.");
                    break;
                }
                //foreach (TableDefinitionPart tableDefinitionPart in worksheetPart.TableDefinitionParts)
                //{
                //    VerboseLog("Sheet contains table '" + tableDefinitionPart.Table.DisplayName + "'.");
                //    if (tableDefinitionPart.Table.DisplayName == ExcelTableName)
                //    {
                //        worksheet = worksheetPart.Worksheet;
                //        table = tableDefinitionPart.Table;
                //        VerboseLog("Sheet and table found.");
                //        break;
                //    }
                //}
                //if (table != null)
                //{
                //    break;
                //}
            }
            #endregion
            //if (table == null)
            //{
            //    ReportError("Table '" + ExcelTableName + "' wasn't found in '" + workbookFileName + "'.", true);
            //}
            //else
            //{
            //    string firstColumnHeader = "";
            //    #region Find Excel Column Offsets
            //    VerboseLog("Collecting column offsets for mapped columns.");
            //    int columnIndex = 1;
            //    foreach (TableColumn tableColumn in table.TableColumns)
            //    {
            //        if (columnIndex == 1)
            //        {
            //            firstColumnHeader = tableColumn.Name;
            //        }
            //        foreach (ColumnMapping columnRelationship in this._columnMappings)
            //        {
            //            if (tableColumn.Name == columnRelationship.ExcelColumnName)
            //            {
            //                VerboseLog("Found Excel column " + tableColumn.Name + " at offset " + columnIndex.ToString());
            //                columnRelationship.ExcelColumnOffset = columnIndex;
            //                break;
            //            }
            //        }
            //        columnIndex++;
            //    }
            //    #region Throw an error if not all columns were found
            //    foreach (ColumnMapping columnRelationship in this._columnMappings)
            //    {
            //        if (!columnRelationship.ExcelColumnFound)
            //        {
            //            string message = "Unable to locate column '" + columnRelationship.ExcelColumnName + "' in table '" + ExcelTableName + "'.";
            //            ReportError(message, true);
            //        }
            //    }
            //    #endregion
            //    #endregion
            if (worksheet == null)
            {
                ReportError("Sheet '" + ExcelSheetName + "' wasn't found in '" + workbookFileName + "'.", true);
            }
            else
            {
                string firstColumnHeader = "";
                #region Read spreadsheet data into SSIS output buffer
                SheetData sheetData = worksheet.GetFirstChild<SheetData>();
                IEnumerable<Row> rows = sheetData.Elements<Row>();
                #region Find First Row
                UInt32 firstRow = 0;
                // VerboseLog("Finding first row of table.");
                VerboseLog("Finding first row of sheet.");
                foreach (Row row in rows)
                {
                    foreach (Cell cell in row.Elements<Cell>())
                    {
                        if (this.CellReferenceToCoordinates(cell.CellReference)[0] == 1)
                        {
                            if (this.GetCellValue(cell, sharedStringTablePart) == firstColumnHeader)
                            {
                                firstRow = row.RowIndex + 1;
                            }
                        }
                    }
                }
                // VerboseLog("First row of table is on row " + firstRow.ToString() + ".");
                VerboseLog("First row of sheet is on row " + firstRow.ToString() + ".");
                #endregion
                // VerboseLog("Preparing to read " + rows.Count<Row>().ToString() + " table rows from Excel.");
                VerboseLog("Preparing to read " + rows.Count<Row>().ToString() + " sheet rows from Excel.");
                foreach (Row row in rows)
                {
                    VerboseLog("Reading row " + row.RowIndex.ToString() + ".");
                    if (row.RowIndex < firstRow)
                    {
                        VerboseLog("Skipping non-table or header row.");
                    }
                    else
                    {
                        VerboseLog("Reading data row " + (row.RowIndex - 1).ToString() + ".");
                        bool rowAdded = false;
                        foreach (Cell cell in row.Elements<Cell>())
                        {
                            foreach (ColumnMapping columnRelationship in this._columnMappings)
                            {
                                if (this.CellReferenceToCoordinates(cell.CellReference)[0] == columnRelationship.ExcelColumnOffset)
                                {
                                    string cellValue = this.GetCellValue(cell, sharedStringTablePart);
                                    if ((cellValue == null)
                                        || ((cellValue == "") && columnRelationship.TreatBlanksAsNulls))
                                    {
                                        // do nothing
                                    }
                                    else
                                    {
                                        if (!rowAdded)
                                        {
                                            Output0Buffer.AddRow();
                                            rowAdded = true;
                                        }
                                        VerboseLog("Excel column '" + columnRelationship.ExcelColumnName + "' contains '" + cellValue + "'.");
                                        columnRelationship.SetSSISBuffer(this.GetCellValue(cell, sharedStringTablePart));
                                    }
                                }
                            }
                        }
                    }
                }
                #endregion
            }
        }
        #region catch ...
        catch (Exception ex)
        {
            ReportError("Unable to open Excel file using OpenXML API: " + ex.Message, true);
        }
        #endregion
        VerboseLog("Closing Excel file");
        document.Close();
    }
 public void Initialize(IDTSComponentMetaData100 dtsComponentMetadata, IServiceProvider serviceProvider)
 {
     this.DtsComponentMetaData100 = dtsComponentMetadata;
     this.ServiceProvider = serviceProvider;
     this.ComponentMetadataWrapper = new __ComponentMetadataWrapper(this.DtsComponentMetaData100, this.GetDictionaryUnitOfWork);
 }
Example #20
0
 /// <summary>
 /// Initialize is called before Edit() to give us the component metadata for the 
 /// component about to be edited, and an IServiceProvider where we can ask
 /// for common VS and SSIS services, like creating connection managers... (see below)
 /// </summary>
 public void Initialize(IDTSComponentMetaData100 dtsComponentMetadata, IServiceProvider serviceProvider)
 {
     // Save off the component metadata and the service provider interfaces for later...
     component_ = dtsComponentMetadata;
     serviceProvider_ = serviceProvider;
 }
		public void ConstructPackage(bool createNew)
		{
			
			// Create SSIS package
			package = new Microsoft.SqlServer.Dts.Runtime.Package();

			// Add DataFlow task
			dataFlowTask = package.Executables.Add("STOCK:PipelineTask");
			TaskHost taskhost = dataFlowTask as TaskHost;
			taskhost.Name = "Data Flow Task";
			pipeline = taskhost.InnerObject as MainPipe;

			// Add source connection manager and adapter
            if (SourceProvider == null)
            {
                throw new InvalidOperationException("Empty source provider.");
            }
            else
            {
                srcConnMgr = SourceProvider.AddConnectionManager(package);
                srcComp = SourceProvider.AddSourceAdapter(pipeline, srcConnMgr);
            }


			// Add destination connection manager and adapter, create new table if asked to.
            if (DestProvider == null)
            {
                throw new InvalidOperationException("Empty destination provider.");
            }
            else
            {
                if (createNew)
                {
                    DestProvider.CreateDestination(srcComp.OutputCollection[0].OutputColumnCollection);
                }
                destConnMgr = DestProvider.AddConnectionManager(package);
                destComp = DestProvider.AddDestAdapter(pipeline, destConnMgr, out destDesignTimeComp);
            }

		}
        /// <summary>
        /// Initialize is called before Edit() to give us the component metadata for the 
        /// component about to be edited, and an IServiceProvider where we can ask
        /// for common VS and SSIS services, like creating connection managers... (see below)
        /// </summary>
        public void Initialize(IDTSComponentMetaData100 dtsComponentMetadata, IServiceProvider serviceProvider)
        {
            // Save off the component metadata and the service provider interfaces for later...
            component_ = dtsComponentMetadata;
            serviceProvider_ = serviceProvider;

            needsNewMetaData_ = true;
            manualEditMode_ = false;


        }
Example #23
0
 public static void RegisterOleDBConnection(SsisEmitterContext context, OleDBConnection oleDBConnection, IDTSComponentMetaData100 component)
 {
     oleDBConnection.Initialize(context);
     component.RuntimeConnectionCollection[0].ConnectionManager = DtsConvert.GetExtendedInterface(oleDBConnection.ConnectionManager);
     component.RuntimeConnectionCollection[0].ConnectionManagerID = oleDBConnection.ConnectionManager.ID;
 }
        void IDtsComponentUI.Initialize(Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSComponentMetaData100 dtsComponentMetadata, IServiceProvider serviceProvider)
        {
            this.componentMetadata = dtsComponentMetadata;
            this.serviceProvider = serviceProvider;
            Debug.Assert(this.serviceProvider != null);

            this.errorCollector = this.serviceProvider.GetService(typeof(IErrorCollectionService)) as IErrorCollectionService;
            Debug.Assert(this.errorCollector != null);

            if (this.errorCollector == null)
            {
                throw new InvalidOperationException("Not all editing services available");
            }
        }
Example #25
0
 public Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSBuffer100 CreateFlatBuffer64(UInt64 lSize,
     IDTSComponentMetaData100 pOwner)
 {
     return _innerObject.CreateFlatBuffer64(lSize, pOwner);
 }
Example #26
0
 public void AddComponent(SsisComponent component)
 {
     if (_lastComponent != component.Component)
     {
         _lastComponent = component.Component;
         _componentList.Add(component);
     }
 }
Example #27
0
        // Add this to the Validate method.  This may impact performance so make sure to remove it from the Validation method after the upgrade is done.
        public static void OneTimeUpgrade(IDTSComponentMetaData100 componentMetaData)
        {
            bool isExist = false;

            isExist = false;
            foreach (IDTSCustomProperty100 customProperty in componentMetaData.CustomPropertyCollection)
            {
                if (customProperty.Name == "TableName")
                    isExist = true;
            }
            if (!isExist)
            {
                IDTSCustomProperty100 TableName = componentMetaData.CustomPropertyCollection.New();
                TableName.Name = "TableName";
                TableName.Description = "Specifies the table name associated with the exception";
                TableName.Value = (componentMetaData.Name.Split())[0].Replace("[email protected]", "edfi.");
            }
        }
Example #28
0
 public Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSBuffer100 CreateBuffer(Int32 hBufferType,
     IDTSComponentMetaData100 pOwner)
 {
     return _innerObject.CreateBuffer(hBufferType, pOwner);
 }
Example #29
0
        public static string GetValidationErrorMessage(IDTSComponentMetaData100 componentMetaData)
        {
            // Validate that TableName is specified in a format of <schema>.<table>
            if (componentMetaData.CustomPropertyCollection["TableName"].Value == null)
            {
                return "Need to specify TableName in the Component Properties tab.";
            }
            else
            {
                string tableName = componentMetaData.CustomPropertyCollection["TableName"].Value.ToString();
                if (!Regex.IsMatch(tableName, @"(.+)\.(.+)", RegexOptions.IgnoreCase))
                {
                    return "TableName needs to include both schema and table name.";
                }
            }


            // Validate that ErrorCode and ErrorColumn are included in the input selection
            int errorCodeFound = 0;
            int errorColumnFound = 0;
            foreach (IDTSInputColumn100 column in componentMetaData.InputCollection[0].InputColumnCollection)
            {
                string columnName = column.Name;
                if (Regex.IsMatch(columnName, "(.*?)ErrorCode$", RegexOptions.IgnoreCase)) errorCodeFound++;
                if (Regex.IsMatch(columnName, "(.*?)ErrorColumn$", RegexOptions.IgnoreCase)) errorColumnFound++; ;
            }


            if (errorCodeFound == 0)
                return "Need to include ErrorCode in the Input Columns tab.";
            else if (errorCodeFound > 1)
                return "Only one ErrorCode is allowed in the Input Columns tab.";

            if (errorColumnFound == 0)
                return "Need to include ErrorColumn in the Input Columns tab.";
            else if (errorColumnFound > 1)
                return "Only one ErrorColumn is allowed in the Input Columns tab.";

            // No validation errror
            return "";
        }