Beispiel #1
0
        public override void ProvideComponentProperties()
        {
            // Remise à zéro du composant
            base.RemoveAllInputsOutputsAndCustomProperties();
            ComponentMetaData.RuntimeConnectionCollection.RemoveAll();

            // Création de la sortie
            ComponentMetaData.OutputCollection.New();
            ComponentMetaData.OutputCollection[0].Name = "Output";

            // Proprités personnalisées
            IDTSCustomProperty100 storageConnectionStringProperty = this.ComponentMetaData.CustomPropertyCollection.New();

            storageConnectionStringProperty.Name           = "StorageConnectionString";
            storageConnectionStringProperty.Description    = "Chaîne de connexion au stockage Azure";
            storageConnectionStringProperty.Value          = "UseDevelopmentStorage=true";
            storageConnectionStringProperty.ExpressionType = DTSCustomPropertyExpressionType.CPET_NOTIFY;

            IDTSCustomProperty100 tableNameProperty = this.ComponentMetaData.CustomPropertyCollection.New();

            tableNameProperty.Name           = "TableName";
            tableNameProperty.Description    = "Nom de la table";
            tableNameProperty.Value          = string.Empty;
            tableNameProperty.ExpressionType = DTSCustomPropertyExpressionType.CPET_NOTIFY;
        }
Beispiel #2
0
        private void ProcessDataFlow(MainPipe mainPipe, TaskHost taskHost)
        {
            foreach (IDTSComponentMetaData100 comp in mainPipe.ComponentMetaDataCollection)
            {
                string key = PackageHelper.GetComponentKey(comp);
                if (!PackageHelper.ComponentInfos.ContainsKey(key))
                {
                    System.Diagnostics.Debug.WriteLine("DataFlowPerformancePractice (170): Key not found '" + key + "'");
                    continue;
                }
                if (PackageHelper.ComponentInfos[key].Name == "OLE DB Source" ||
                    PackageHelper.ComponentInfos[key].Name == "ADO NET Source" ||
                    PackageHelper.ComponentInfos[key].Name == "Lookup")
                {
                    IDTSCustomProperty100 prop = null;
                    try
                    {
                        prop = comp.CustomPropertyCollection["AccessMode"]; //was throwing an error on some Lookup components
                    }
                    catch { }

                    if (prop != null && prop.Value is int)
                    {
                        switch ((SourceAccessMode)prop.Value)
                        {
                        case SourceAccessMode.AM_OPENROWSET:
                        case SourceAccessMode.AM_OPENROWSET_VARIABLE:
                            Results.Add(new Result(false, String.Format("Change the {0} component to use a SQL Command access mode, as this performs better than the OpenRowset access mode.", comp.Name), ResultSeverity.Normal));
                            break;
                        }
                    }
                }
            }
        }
Beispiel #3
0
        public override void ProvideComponentProperties()
        {
            // Reset the component.
            base.RemoveAllInputsOutputsAndCustomProperties();
            ComponentMetaData.RuntimeConnectionCollection.RemoveAll();

            IDTSInput100 input = ComponentMetaData.InputCollection.New();

            input.Name = "Input";

            // MongoDBConnectionManager
            IDTSRuntimeConnection100 connection = ComponentMetaData.RuntimeConnectionCollection.New();

            connection.Name = MONGO_CONN;

            // Database name
            IDTSCustomProperty100 dbname = ComponentMetaData.CustomPropertyCollection.New();

            dbname.Name = MONGO_DB;

            // Collection name in MongoDB
            IDTSCustomProperty100 collname = ComponentMetaData.CustomPropertyCollection.New();

            collname.Name = MONGO_COLL;

            // How many rows per InsertBatch
            IDTSCustomProperty100 batchSize = ComponentMetaData.CustomPropertyCollection.New();

            batchSize.Name = MONGO_BATCH_SIZE;
        }
        private void commandTimeoutTextBox_TextChanged(object sender, EventArgs e)
        {
            IDTSCustomProperty100 propCommandTimeout = component_.CustomPropertyCollection[COMMAND_TIMEOUT];

            string commandTimeoutValue = this.commandTimeoutTextBox.Text;

            try
            {
                int timeout = Int32.Parse(commandTimeoutValue);

                if (timeout < 0)
                {
                    throw new Exception("Command-timeout must be a non-negative integer.");
                }

                propCommandTimeout.Value = timeout;
            }
            catch (Exception)
            {
                MessageBox.Show("Command-timeout must be a non-negative integer.",
                                "Validation error for command-timeout",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);

                this.commandTimeoutTextBox.Text = propCommandTimeout.Value.ToString();
            }
        }
        // --------------DESIGN METHODS------------------------//
        public override void ProvideComponentProperties()
        {
            base.RemoveAllInputsOutputsAndCustomProperties();

            IDTSInput100 input = ComponentMetaData.InputCollection.New();

            input.Name = "Input";

            //IDTSInputColumn100 col1 = input.InputColumnCollection.New();

            IDTSOutput100 output = ComponentMetaData.OutputCollection.New();

            output.Name = "Output";
            output.SynchronousInputID = input.ID;

            IDTSCustomProperty100 serverProp = ComponentMetaData.CustomPropertyCollection.New();

            serverProp.Name        = "ServerAddress";
            serverProp.Description = "Hostname/IP address of VoltDB server";

            IDTSCustomProperty100 tableProp = ComponentMetaData.CustomPropertyCollection.New();

            tableProp.Name        = "TableName";
            tableProp.Description = "Name of the VoltDB table to insert into";

            ComponentMetaData.ContactInfo = "*****@*****.**";
            ComponentMetaData.Version     = 121506;
        }
        private void SetOutputProperties(Condition condition, string defaultOutputPath)
        {
            IDTSOutput100 newPath = _component.OutputCollection.New();

            newPath.Name        = condition.OutputPath;
            newPath.Description = condition.OutputPath;
//            newPath.ExclusionGroup = _component.OutputCollection["Conditional Split Default Output"].ExclusionGroup;
//            newPath.SynchronousInputID = _component.OutputCollection["Conditional Split Default Output"].SynchronousInputID;
            newPath.ExclusionGroup             = _component.OutputCollection[defaultOutputPath].ExclusionGroup;
            newPath.SynchronousInputID         = _component.OutputCollection[defaultOutputPath].SynchronousInputID;
            newPath.ErrorOrTruncationOperation = "Computation";
            newPath.ErrorRowDisposition        = DTSRowDisposition.RD_IgnoreFailure;
            newPath.TruncationRowDisposition   = DTSRowDisposition.RD_FailComponent;

            IDTSCustomProperty100 propEvaluationOrder = newPath.CustomPropertyCollection.New();

            propEvaluationOrder.Name  = "EvaluationOrder";
            propEvaluationOrder.Value = _iEvaluationOrder;

            IDTSCustomProperty100 propFriendlyExpression = newPath.CustomPropertyCollection.New();

            propFriendlyExpression.Name  = "FriendlyExpression";
            propFriendlyExpression.Value = condition.Expression;

            IDTSCustomProperty100 propExpression = newPath.CustomPropertyCollection.New();

            propExpression.Name = "Expression";
            IDTSVirtualInput100 vi = _component.InputCollection[0].GetVirtualInput();

            propExpression.Value = ExpressionCleanerAndInputMapBuilder(condition.Expression, vi, DTSUsageType.UT_READONLY);;

            _component.OutputCollection.SetIndex(_component.OutputCollection.GetObjectIndexByID(newPath.ID), 0);
            _iEvaluationOrder++;
        }
Beispiel #7
0
        private IMongoQuery BuildQuery(IDTSCustomProperty100 condFieldProp, IDTSCustomProperty100 fromProp, IDTSCustomProperty100 toProp)
        {
            BsonValue fromValue = GetBsonValueForQueryCondition(condFieldProp.Value, fromProp.Value);
            BsonValue toValue   = GetBsonValueForQueryCondition(condFieldProp.Value, toProp.Value);

            return(BuildQuery(condFieldProp.Value, fromValue, toValue));
        }
        // v2
        public override void PerformUpgrade(int pipelineVersion)
        {
            DtsPipelineComponentAttribute pipelineComponentAttribute = (DtsPipelineComponentAttribute)Attribute.GetCustomAttribute(this.GetType(), typeof(DtsPipelineComponentAttribute), false);
            Int32 componentLatestVersion = pipelineComponentAttribute.CurrentVersion;

            Int32 activeComponentVersion = ComponentMetaData.Version;

            if (activeComponentVersion < componentLatestVersion)
            {
                try
                {
                    IDTSCustomProperty100 existingRegularExpressionsOptions = ComponentMetaData.CustomPropertyCollection[REGEX_OPTIONS_PROPERTY_NAME];
                }
                catch (Exception)
                {
                    IDTSCustomProperty100 regularExpressionsOptions = ComponentMetaData.CustomPropertyCollection.New();
                    regularExpressionsOptions.Name          = REGEX_OPTIONS_PROPERTY_NAME;
                    regularExpressionsOptions.Description   = REGEX_OPTIONS_PROPERTY_DESCRIPTION;
                    regularExpressionsOptions.State         = DTSPersistState.PS_DEFAULT;
                    regularExpressionsOptions.TypeConverter = typeof(Int64).AssemblyQualifiedName;
                    regularExpressionsOptions.Value         = REGEX_OPTIONS_UPGRADE_VALUE;
                }
            }

            ComponentMetaData.Version = componentLatestVersion;
        }
Beispiel #9
0
        /// <summary>
        /// Adds the custom property that contains the GUID
        /// </summary>
        /// <param name="guid">GUID</param>
        /// <param name="propCollection">custom property collection of the input column</param>
        private static void AddIdProperty(string guid, IDTSCustomPropertyCollection100 propCollection)
        {
            IDTSCustomProperty100 prop = propCollection.New();

            prop.Name  = IdPropertyName;
            prop.Value = guid;
        }
        //DataSet data = JsonConvert.DeserializeObject<DataSet>(json);
        /// <summary>
        /// Properties which required to make connection to couchbase
        /// </summary>
        public override void ProvideComponentProperties()
        {
            //base.ProvideComponentProperties();
            //ComponentMetaData.RuntimeConnectionCollection.RemoveAll();
            //RemoveAllInputsOutputsAndCustomProperties();

            IDTSCustomProperty100 couchbaseProperty = ComponentMetaData.CustomPropertyCollection.New();

            couchbaseProperty.Name  = "EngineAddress";
            couchbaseProperty.Value = "http://localhost:8091";

            couchbaseProperty       = ComponentMetaData.CustomPropertyCollection.New();
            couchbaseProperty.Name  = "BucketName";
            couchbaseProperty.Value = string.Empty;

            couchbaseProperty       = ComponentMetaData.CustomPropertyCollection.New();
            couchbaseProperty.Name  = "BucketPassword";
            couchbaseProperty.Value = string.Empty;

            couchbaseProperty       = ComponentMetaData.CustomPropertyCollection.New();
            couchbaseProperty.Name  = "BucketDedicatedPort";
            couchbaseProperty.Value = string.Empty;

            couchbaseProperty       = ComponentMetaData.CustomPropertyCollection.New();
            couchbaseProperty.Name  = "N1QL Query";
            couchbaseProperty.Value = string.Empty;
        }
Beispiel #11
0
        private void AddOutputColumn(DerivedColumn column)
        {
            IDTSOutputColumn100 col;

            col                          = _component.OutputCollection[0].OutputColumnCollection.New();
            col.Name                     = column.Name;
            col.Description              = column.Name;
            col.ErrorRowDisposition      = DTSRowDisposition.RD_IgnoreFailure;
            col.TruncationRowDisposition = DTSRowDisposition.RD_FailComponent;
            col.SetDataTypeProperties(GetDataTypeFromString(column.Type), column.Length, column.Precision, column.Scale, column.Codepage);
            col.ExternalMetadataColumnID = 0;

            IDTSCustomProperty100 propExpression = col.CustomPropertyCollection.New();

            propExpression.Name  = "Expression";
            propExpression.Value = column.Expression;

            IDTSCustomProperty100 propFriendlyExpression = col.CustomPropertyCollection.New();

            propFriendlyExpression.Name  = "FriendlyExpression";
            propFriendlyExpression.Value = column.Expression;

            IDTSVirtualInput100 vi = _component.InputCollection[0].GetVirtualInput();

            propExpression.Value = this.ExpressionCleanerAndInputMapBuilder(column.Expression, vi, DTSUsageType.UT_READONLY);
        }
Beispiel #12
0
        private void MapInput(IDTSInput100 input, UnionMapping mapping)
        {
            string inputColumn  = mapping.Input;
            string outputColumn = mapping.Output == null ? mapping.Input : mapping.Output;

            IDTSInputColumn100 newInputColumn = input.InputColumnCollection[inputColumn];

            if (newInputColumn == null)
            {
                newInputColumn = input.InputColumnCollection.New();
            }
            newInputColumn.Name = inputColumn;

            const string          strPropertyName = "OutputColumnLineageID";
            IDTSCustomProperty100 newInputColumnCustomProperty = null;

            foreach (IDTSCustomProperty100 property in newInputColumn.CustomPropertyCollection)
            {
                if (property.Name == strPropertyName)
                {
                    newInputColumnCustomProperty = property;
                    break;
                }
            }
            if (newInputColumnCustomProperty == null)
            {
                newInputColumnCustomProperty = newInputColumn.CustomPropertyCollection.New();
            }

            newInputColumnCustomProperty.Name  = "OutputColumnLineageID";
            newInputColumnCustomProperty.Value = _component.OutputCollection[0].OutputColumnCollection[outputColumn].LineageID;
        }
Beispiel #13
0
        /// <summary>
        /// Add a custom property to an output
        /// For internal use from within this library. Not for use from outside libraries
        /// </summary>
        /// <param name="output"></param>
        /// <param name="propertyName"></param>
        /// <param name="propertyValue"></param>
        internal IDTSCustomProperty100 SetCustomPropertyToOutput(IDTSOutput100 output, string propertyName, object propertyValue)
        {
            bool propertyExists        = false;
            IDTSCustomProperty100 prop = null;

            for (int i = 0; i < output.CustomPropertyCollection.Count; i++)
            {
                if (output.CustomPropertyCollection[i].Name == propertyName)
                {
                    propertyExists = true;
                    break;
                }
            }

            if (propertyExists)
            {
                prop = DesignTimeComponent.SetOutputProperty(output.ID, propertyName, propertyValue);
            }
            else
            {
                prop       = output.CustomPropertyCollection.New();
                prop.Name  = propertyName;
                prop.Value = propertyValue;
            }
            return(prop);
        }
Beispiel #14
0
        /// <summary>
        /// Adds the custom property that contains the GUID
        /// </summary>
        /// <param name="guid">GUID</param>
        /// <param name="propCollection">custom property collection of the input column</param>
        /// <param name="propType">property type</param>
        private static void AddIdProperty(string guid, IDTSCustomPropertyCollection100 propCollection, PropertyType propType)
        {
            IDTSCustomProperty100 prop = propCollection.New();

            prop.Name  = IdPorpertyNameList[(int)propType];
            prop.Value = guid;
        }
        /// <summary>
        /// Called by the DataFlow task to validate the transform
        /// </summary>
        /// <returns></returns>
        public override DTSValidationStatus Validate()
        {
            IDTSCustomProperty100 rxPropExpression = ComponentMetaData.CustomPropertyCollection[s_RegExpPropName];

            // If there is no regular expression or if the input file does not exist we mark the component broken and output an error.
            if ((rxPropExpression == null) || (String.IsNullOrEmpty(rxPropExpression.Value.ToString())))
            {
                bool cancel;
                ComponentMetaData.FireError(HResults.DTS_E_VALIDATIONFAILED, s_RegExpPropName, "Specify a non-empty regular expression!", null, 0, out cancel);
                return(DTSValidationStatus.VS_ISBROKEN);
            }
            // check if the input file exists...
            else if (System.IO.File.Exists(ComponentMetaData.CustomPropertyCollection[s_InputFilePathNamePropName].Value.ToString()))
            {
                // Check to see if the number and/or name of columns changed based on the regular expression property
                // If it did change than return DTSValidationStatus.VS_NEEDSNEWMETADATA to request that ReinitializeMetaData is called to update the component metadata
                Regex    rx   = new Regex(rxPropExpression.Value.ToString());
                string[] grps = rx.GetGroupNames();

                // If the regular expression and the matching output are out of sync
                // we return DTSValidationStatus.VS_NEEDSNEWMETADATA to trigger a call to ReinitializeMetadata
                if (ColumnMetadataChanged(grps))
                {
                    return(DTSValidationStatus.VS_NEEDSNEWMETADATA);
                }
                return(base.Validate());
            }
            else
            {
                bool cancel;
                ComponentMetaData.FireError(HResults.DTS_E_VALIDATIONFAILED, s_InputFilePathNamePropName, "Specify an existing file!", null, 0, out cancel);
                return(DTSValidationStatus.VS_ISBROKEN);
            }
        }
        //=================================================================================================

        private string GetWqlString()
        {
            IDTSCustomProperty100 propQuery = null;

            try
            {
                propQuery = ComponentMetaData.CustomPropertyCollection[WQL_QUERY];
            }
            catch
            { }

            if (propQuery == null || propQuery.Value == null || propQuery.Value.ToString().Trim().Length == 0)
            {
                bool bCancel;

                ComponentMetaData.FireError(
                    HResults.DTS_E_ERROROCCURREDWITHFOLLOWINGMESSAGE,
                    ComponentMetaData.Name,
                    "The WQL query has not been set correctly. Check WqlQuery property.",
                    "",
                    0,
                    out bCancel);

                throw new PipelineComponentHResultException("The WQL query has not been set correctly. Check WqlQuery property.", HResults.DTS_E_ERROROCCURREDWITHFOLLOWINGMESSAGE);
            }

            return(propQuery.Value.ToString().Trim());
        }
Beispiel #17
0
        /// <summary>
        /// DTSs the validation status.
        /// </summary>
        /// <param name="customPropertyName">
        /// Name of the custom property.
        /// </param>
        /// <returns>
        /// DTS Validation Status
        /// </returns>
        private DTSValidationStatus DtsValidationStatus(string customPropertyName)
        {
            try
            {
                IDTSCustomProperty100 customProperty =
                    this.ComponentMetaData.CustomPropertyCollection[this.customPropertiesList[customPropertyName].Name];
                if (customProperty == null)
                {
                    this.InternalFireError(
                        string.Format(
                            "The {0} property has been removed from the component.",
                            this.customPropertiesList[customPropertyName].Name));
                    return(DTSValidationStatus.VS_NEEDSNEWMETADATA);
                }
            }
            catch
            {
                // The property doesn't exist.
                this.InternalFireError(
                    string.Format(
                        "The {0} property has been removed from the component.",
                        this.customPropertiesList[customPropertyName].Name));
                return(DTSValidationStatus.VS_NEEDSNEWMETADATA);
            }

            return(DTSValidationStatus.VS_ISVALID);
        }
        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]);
        }
Beispiel #19
0
        /// <summary>
        /// The check custom propertry.
        /// </summary>
        /// <param name="customPropertyKeyName">
        /// The custom Property Key Name.
        /// </param>
        /// <returns>
        /// The DTS Validation Status
        /// </returns>
        private DTSValidationStatus CheckCustomPropertry(string customPropertyKeyName)
        {
            try
            {
                IDTSCustomProperty100 customProperty =
                    this.ComponentMetaData.CustomPropertyCollection[
                        this.customPropertiesList[customPropertyKeyName].Name];
                if (customProperty == null)
                {
                    this.InternalFireError(
                        string.Format(
                            "The {0} property has been removed from the component.",
                            this.customPropertiesList[customPropertyKeyName].Name));
                    return(DTSValidationStatus.VS_NEEDSNEWMETADATA);
                }

                if (string.Compare((string)customProperty.Value, string.Empty) == 0)
                {
                    this.InternalFireError(string.Format("The {0} property is set incorrectly.", customProperty.Name));
                    return(DTSValidationStatus.VS_NEEDSNEWMETADATA);
                }

                return(DTSValidationStatus.VS_ISVALID);
            }
            catch
            {
                // The property doesn't exist.
                this.InternalFireError(
                    string.Format(
                        "The {0} property has been removed from the component.",
                        this.customPropertiesList[customPropertyKeyName].Name));
                return(DTSValidationStatus.VS_NEEDSNEWMETADATA);
            }
        }
Beispiel #20
0
        public override void ProvideComponentProperties()
        {
            base.ProvideComponentProperties();
            base.RemoveAllInputsOutputsAndCustomProperties();

            IDTSCustomProperty100 queuePath = ComponentMetaData.CustomPropertyCollection.New();

            queuePath.Description    = "The MSMQ path";
            queuePath.Name           = QueuePathName;
            queuePath.Value          = String.Empty;
            queuePath.ExpressionType = DTSCustomPropertyExpressionType.CPET_NOTIFY;

            IDTSOutput100 output = ComponentMetaData.OutputCollection.New();

            output.Name = "Output";

            var bodyColumn = ComponentMetaData.OutputCollection[0].OutputColumnCollection.New();

            bodyColumn.Name = BodyColumnName;
            bodyColumn.SetDataTypeProperties(DataType.DT_NTEXT, 0, 0, 0, 0);

            var labelColumn = ComponentMetaData.OutputCollection[0].OutputColumnCollection.New();

            labelColumn.Name = LabelColumnName;
            labelColumn.SetDataTypeProperties(DataType.DT_WSTR, 4000, 0, 0, 0);

            var idColumn = ComponentMetaData.OutputCollection[0].OutputColumnCollection.New();

            idColumn.Name = IdColumnName;
            idColumn.SetDataTypeProperties(DataType.DT_WSTR, 100, 0, 0, 0);
        }
Beispiel #21
0
        /// <summary>
        /// Sets a custom property to an output column; adds it if the property does not exist.
        /// For internal use within this library. Not for use from outside libraries
        /// </summary>
        /// <param name="input"></param>
        /// <param name="inputColumn"></param>
        /// <param name="propertyName"></param>
        /// <param name="propertyValue"></param>
        internal void SetCustomPropertyToInputColumn(IDTSInput100 input, IDTSInputColumn100 inputColumn, string propertyName, object propertyValue, bool containsId = false)
        {
            bool propertyExists        = false;
            IDTSCustomProperty100 prop = null;

            for (int i = 0; i < inputColumn.CustomPropertyCollection.Count; i++)
            {
                if (inputColumn.CustomPropertyCollection[i].Name == propertyName)
                {
                    propertyExists = true;
                    //prop =
                    break;
                }
            }
            if (propertyExists)
            {
                prop            = DesignTimeComponent.SetInputColumnProperty(input.ID, inputColumn.ID, propertyName, propertyValue);
                prop.ContainsID = containsId;
            }
            else
            {
                prop            = inputColumn.CustomPropertyCollection.New();
                prop.Name       = propertyName;
                prop.Value      = propertyValue;
                prop.ContainsID = containsId;
            }
        }
        private void batchSizeTextBox_TextChanged(object sender, EventArgs e)
        {
            IDTSCustomProperty100 propBatchSize = component_.CustomPropertyCollection[BATCH_SIZE];

            string batchSizeValue = batchSizeTextBox.Text;

            try
            {
                int size = Int32.Parse(batchSizeValue);

                if (size < 0)
                {
                    throw new Exception("Batchsize must be a non-negative integer.");
                }

                propBatchSize.Value = size;
            }
            catch (Exception)
            {
                MessageBox.Show("Batchsize must be a non-negative integer.",
                                "Validation error for batchsize",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);

                batchSizeTextBox.Text = propBatchSize.Value.ToString();
            }
        }
Beispiel #23
0
        /// <summary>
        /// Sets a custom property to an output column; adds it if the property does not exist.
        /// For internal use within this library. Not for use from outside libraries
        /// </summary>
        /// <param name="output"></param>
        /// <param name="outputColumn"></param>
        /// <param name="propertyName"></param>
        /// <param name="propertyValue"></param>
        /// <param name="containsId"></param>
        /// <returns></returns>
        internal IDTSCustomProperty100 SetCustomPropertyToOutputColumn(IDTSOutput100 output, IDTSOutputColumn100 outputColumn, string propertyName, object propertyValue, bool containsId = false)
        {
            bool propertyExists = false;
            IDTSCustomProperty100 customProperty = null;

            for (int i = 0; i < outputColumn.CustomPropertyCollection.Count; i++)
            {
                if (outputColumn.CustomPropertyCollection[i].Name == propertyName)
                {
                    propertyExists = true;
                    break;
                }
            }
            if (propertyExists)
            {
                customProperty            = DesignTimeComponent.SetOutputColumnProperty(output.ID, outputColumn.ID, propertyName, propertyValue);
                customProperty.ContainsID = containsId;
            }
            else
            {
                customProperty            = outputColumn.CustomPropertyCollection.New();
                customProperty.Name       = propertyName;
                customProperty.Value      = propertyValue;
                customProperty.ContainsID = containsId;
            }

            return(customProperty);
        }
Beispiel #24
0
        /// <summary>
        /// This method is ivoked once, when the user double clicks on it at design time.
        /// </summary>
        /// <param name="dtsComponentMetadata"></param>
        /// <param name="serviceProvider"></param>
        public void Initialize(IDTSComponentMetaData100 dtsComponentMetadata, IServiceProvider serviceProvider)
        {
            // Save a reference to the components metadata and service provider
            _sp = serviceProvider;
            _md = dtsComponentMetadata;

            // Check model: if no model was specified, add it one now.
            IDTSCustomProperty100 model = null;

            try
            {
                model  = dtsComponentMetadata.CustomPropertyCollection[ComponentConstants.PROPERTY_KEY_MODEL];
                _model = JSONSourceComponentModel.LoadFromJson(model.Value.ToString());
            }
            catch (Exception e) {
                // No model found. Add a new now.
                _model      = new JSONSourceComponentModel();
                model       = dtsComponentMetadata.CustomPropertyCollection.New();
                model.Name  = ComponentConstants.PROPERTY_KEY_MODEL;
                model.Value = _model.ToJsonConfig();
            }

            if (_md == null)
            {
                _md = (IDTSComponentMetaData100)_md.Instantiate();
            }

            _virtualInputLane = dtsComponentMetadata.InputCollection[ComponentConstants.NAME_INPUT_LANE_PARAMS].GetVirtualInput();
        }
Beispiel #25
0
        /// <summary>
        /// Add user and hidden properties to configure the control
        /// </summary>
        public override void ProvideComponentProperties()
        {
            base.RemoveAllInputsOutputsAndCustomProperties();
            ComponentMetaData.RuntimeConnectionCollection.RemoveAll();


            ComponentMetaData.Name        = "Dynamics CRM Source Adapter";
            ComponentMetaData.ContactInfo = "*****@*****.**";
            ComponentMetaData.Description = "Allows to connect to Dynamics CRM Source";

            IDTSOutput100 output = ComponentMetaData.OutputCollection.New();

            output.Name = "Output";

            IDTSCustomProperty100 FetchXML = ComponentMetaData.CustomPropertyCollection.New();

            FetchXML.Description = "FetchXML query to get information from Dynamics";
            FetchXML.Name        = "FetchXML";
            FetchXML.Value       = String.Empty;

            IDTSRuntimeConnection100 connection = ComponentMetaData.RuntimeConnectionCollection.New();

            connection.Name = "CRMSSIS";
            connection.ConnectionManagerID = "CRMSSIS";
        }
Beispiel #26
0
        public IDTSOutputColumn100 ModifyComp_DerivedCol_AddCol(IDTSComponentMetaData100 Comp,
                                                                string DCName,
                                                                string DCExpression,
                                                                DataType DTDataType,
                                                                int DCDTLength    = 0,
                                                                int DCDTPrecision = 0,
                                                                int DCDTScale     = 0,
                                                                int DCDTCodePage  = 0
                                                                )
        {
            IDTSOutputColumn100 Col = Comp.OutputCollection[0].OutputColumnCollection.New();

            Col.Name = DCName;
            Col.SetDataTypeProperties(DTDataType, DCDTLength, DCDTPrecision, DCDTScale, DCDTCodePage);
            Col.ExternalMetadataColumnID = 0;
            Col.ErrorRowDisposition      = DTSRowDisposition.RD_FailComponent;
            Col.TruncationRowDisposition = DTSRowDisposition.RD_FailComponent;

            IDTSCustomProperty100 propExp = Col.CustomPropertyCollection.New();

            propExp.Name  = "Expression";
            propExp.Value = DCExpression;

            IDTSCustomProperty100 propFrExp = Col.CustomPropertyCollection.New();

            propFrExp.Name  = "FriendlyExpression";
            propFrExp.Value = DCExpression;

            return(Col);
        }
        private void AddProperty(string name, string description, object value)
        {
            IDTSCustomProperty100 property = this.ComponentMetaData.CustomPropertyCollection.New();

            property.Name        = name;
            property.Description = description;
            property.Value       = value;
        }
Beispiel #28
0
        public override void ProvideComponentProperties()
        {
            base.ProvideComponentProperties();

            // Data Profile File Name
            IDTSCustomProperty100 dataProfileFileName = ComponentMetaData.CustomPropertyCollection.New();

            dataProfileFileName.Name          = DATA_PROFILE_FILE_NAME_PROPERTY_NAME;
            dataProfileFileName.Description   = DATA_PROFILE_FILE_NAME_PROPERTY_DESCRIPTION;
            dataProfileFileName.State         = DTSPersistState.PS_PERSISTASCDATA;
            dataProfileFileName.TypeConverter = typeof(String).AssemblyQualifiedName;
            dataProfileFileName.Value         = String.Empty;

            // Data Profile Column Name
            IDTSCustomProperty100 dataProfileColumnName = ComponentMetaData.CustomPropertyCollection.New();

            dataProfileColumnName.Name          = DATA_PROFILE_COLUMN_NAME_PROPERTY_NAME;
            dataProfileColumnName.Description   = DATA_PROFILE_COLUMN_NAME_PROPERTY_DESCRIPTION;
            dataProfileColumnName.State         = DTSPersistState.PS_DEFAULT;
            dataProfileColumnName.TypeConverter = typeof(String).AssemblyQualifiedName;
            dataProfileColumnName.Value         = String.Empty;

            // Input
            IDTSInput100 input = ComponentMetaData.InputCollection[0];

            input.Name = INPUT_NAME;
            // Input Column Name
            IDTSCustomProperty100 inputColumnName = input.CustomPropertyCollection.New();

            inputColumnName.Name          = INPUT_COLUMN_NAME;
            inputColumnName.Description   = INPUT_COLUMN_DESCRIPTION;
            inputColumnName.State         = DTSPersistState.PS_DEFAULT;
            inputColumnName.TypeConverter = typeof(String).AssemblyQualifiedName;
            inputColumnName.Value         = String.Empty;

            IDTSCustomProperty100 isInternal;
            // Synchronous Output
            IDTSOutput100 output = ComponentMetaData.OutputCollection[0];

            output.Name = OUTPUT_NAME;
            output.SynchronousInputID = ComponentMetaData.InputCollection[0].ID;
            isInternal               = output.CustomPropertyCollection.New();
            isInternal.Name          = IS_INTERNAL_OBJECT_PROPERTY_NAME;
            isInternal.State         = DTSPersistState.PS_DEFAULT;
            isInternal.TypeConverter = typeof(Boolean).AssemblyQualifiedName;
            isInternal.Value         = true;
            // Output column
            IDTSOutputColumn100 isVaildEmailColumn = output.OutputColumnCollection.New();

            isVaildEmailColumn.Name        = IS_VALID_COLUMN_NAME;
            isVaildEmailColumn.Description = IS_VALID_COLUMN_DESCRIPTION;
            isVaildEmailColumn.SetDataTypeProperties(DataType.DT_BOOL, 0, 0, 0, 0);
            isInternal               = isVaildEmailColumn.CustomPropertyCollection.New();
            isInternal.Name          = IS_INTERNAL_OBJECT_PROPERTY_NAME;
            isInternal.State         = DTSPersistState.PS_DEFAULT;
            isInternal.TypeConverter = typeof(Boolean).AssemblyQualifiedName;
            isInternal.Value         = true;
        }
        public void GetPropertyValueTest()
        {
            IDTSCustomPropertyCollection100 customPropertyCollection = new CustomPropertyCollectionTestImpl();
            IDTSCustomProperty100           property = customPropertyCollection.New();

            property.Name  = "Name";
            property.Value = 77;
            Assert.AreEqual <int>(77, (int)PropertiesManager.GetPropertyValue(customPropertyCollection, "Name"));
        }
Beispiel #30
0
        /// <summary>
        /// Create component properties.
        /// </summary>
        private void CreateCustomProperties()
        {
            // Hash algorithm property.
            IDTSCustomProperty100 hashAlgorithm = ComponentMetaData.CustomPropertyCollection.New();

            hashAlgorithm.Name          = _hashAlgorithmPropertyName;
            hashAlgorithm.Description   = _hashAlgorithmPropertyDescription;
            hashAlgorithm.TypeConverter = typeof(SupportedHashAlgorithm).AssemblyQualifiedName;
            hashAlgorithm.Value         = SupportedHashAlgorithm.RIPEMD160;
        }
 public DataFlowPropertyNodeFactory(IDTSCustomProperty100 input)
 {
     _input = input;
 }
Beispiel #32
0
 internal BipsProxyIDTSCustomProperty100(IDTSCustomProperty100 innerObject)
 {
     _innerObject = innerObject;
 }
Beispiel #33
0
        private IMongoQuery BuildQuery(IDTSCustomProperty100 condFieldProp, IDTSCustomProperty100 fromProp, IDTSCustomProperty100 toProp)
        {
            BsonValue fromValue = GetBsonValueForQueryCondition(condFieldProp.Value, fromProp.Value);
            BsonValue toValue = GetBsonValueForQueryCondition(condFieldProp.Value, toProp.Value);

            return BuildQuery(condFieldProp.Value, fromValue, toValue);
        }
 private void assertSetPropertyNameAndDescription(IDTSCustomProperty100 propMock, String propName)
 {
     Mock.ArrangeSet(() => propMock.Description = Arg.IsAny<String>()).OccursOnce();
     Mock.ArrangeSet(() => propMock.Name = Arg.Matches<String>(x => x == propName)).OccursOnce();
     Mock.ArrangeSet(() => propMock.Value = Arg.IsAny<dynamic>()).OccursOnce();
 }