private void ScanCustomPropertiesCollection(IDTSCustomPropertyCollection100 properties, TreeNode parent)
        {
            // First check if we have a "FriendlyExpression". We use the value from FriendlyExpression, because it is CPET_NOTIFY
            // The related Expression will always be CPET_NONE, and less readable.
            bool friendlyExpressionValid = GetIsFriendlyExpression(properties);

            foreach (IDTSCustomProperty100 property in properties)
            {
                string propertyName = property.Name;
                string value        = property.Value as string;
                if (string.IsNullOrEmpty(value))
                {
                    continue;
                }

                if (property.ExpressionType == DTSCustomPropertyExpressionType.CPET_NOTIFY)
                {
                    // Check the expression string for our matching variable name
                    // We ignore the Task level properties derived from these expressions, because here we have much more context.
                    // Could have expression properties (CPET_NOTIFY) entirely, call it Darren's OCD in action.
                    ExpressionMatchCustomProperty(parent, friendlyExpressionValid, property, propertyName, value);
                }
                else
                {
                    if (property.Name == "Expression" && friendlyExpressionValid)
                    {
                        continue;
                    }

                    PropertyMatch(parent, property, propertyName, value);
                }
            }
        }
Example #2
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;
        }
        private static bool GetIsFriendlyExpression(IDTSCustomPropertyCollection100 properties)
        {
            bool expression = false;
            bool friendly   = false;

            foreach (IDTSCustomProperty100 property in properties)
            {
                string propertyName = property.Name;
                if (propertyName == "FriendlyExpression" && property.ExpressionType == DTSCustomPropertyExpressionType.CPET_NOTIFY)
                {
                    friendly = true;
                }
                else if (propertyName == "Expression" && property.ExpressionType == DTSCustomPropertyExpressionType.CPET_NONE)
                {
                    expression = true;
                }
            }

            if (expression && friendly)
            {
                return(true);
            }

            return(false);
        }
 public static void AddComponentProperties(IDTSCustomPropertyCollection100 propertyCollection)
 {
     AddCustomProperty(propertyCollection, isTextDelmited, MessageStrings.IsTextDelmitedPropDescription, true);
     AddCustomProperty(propertyCollection, textDelmiter, MessageStrings.TextDelmiterPropDescription, "\"");
     AddCustomProperty(propertyCollection, columnDelimiter, MessageStrings.ColumnDelimiterPropDescription, ",");
     AddCustomProperty(propertyCollection, treatEmptyStringsAsNull, MessageStrings.TreatEmptyStringsAsNullPropDescription, true);
 }
Example #5
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;
        }
 public static void AddOutputColumnProperties(IDTSCustomPropertyCollection100 propertyCollection)
 {
     AddCustomProperty(propertyCollection, usageOfColumn, MessageStrings.UsageOfColumnPropDescription, Utilities.usageOfColumnEnum.Passthrough, typeof(Utilities.usageOfColumnEnum).AssemblyQualifiedName);
     AddCustomProperty(propertyCollection, keyOutputColumnID, MessageStrings.KeyOutputColumnIDPropDescription, -1, true);
     AddCustomProperty(propertyCollection, dotNetFormatString, MessageStrings.DotNetFormatStringPropDescription, String.Empty);
     AddCustomProperty(propertyCollection, isColumnOptional, MessageStrings.IsColumnOptionalPropDescription, false);
     AddCustomProperty(propertyCollection, nullResultOnConversionError, MessageStrings.NullResultOnConversionErrorDescription, false);
 }
        public DTSValidationStatus ValidateOutputProperties(IDTSCustomPropertyCollection100 customPropertyCollection, DTSValidationStatus oldStatus)
        {
            DTSValidationStatus resultStatus = oldStatus;

            resultStatus = ValidatePropertyExists(customPropertyCollection, rowTypeValue, resultStatus);
            resultStatus = ValidatePropertyExists(customPropertyCollection, typeOfOutput, resultStatus);
            resultStatus = ValidatePropertyExists(customPropertyCollection, masterRecordID, resultStatus);
            return(resultStatus);
        }
Example #8
0
        protected CustomPropertyWrapper(IDTSCustomPropertyCollection100 dtsCustomPropertyCollection100)
        {
            if ((object)dtsCustomPropertyCollection100 == null)
            {
                throw new ArgumentNullException("dtsCustomPropertyCollection100");
            }

            this.dtsCustomPropertyCollection100 = dtsCustomPropertyCollection100;
        }
        public DTSValidationStatus ValidateComponentProperties(IDTSCustomPropertyCollection100 customPropertyCollection, DTSValidationStatus oldStatus)
        {
            DTSValidationStatus resultStatus = oldStatus;

            resultStatus = ValidatePropertyExists(customPropertyCollection, isTextDelmited, resultStatus);
            resultStatus = ValidatePropertyExists(customPropertyCollection, textDelmiter, resultStatus);
            resultStatus = ValidatePropertyExists(customPropertyCollection, columnDelimiter, resultStatus);
            resultStatus = ValidatePropertyExists(customPropertyCollection, treatEmptyStringsAsNull, resultStatus);
            return(resultStatus);
        }
 static protected void AddProperty(IDTSCustomPropertyCollection100 propertyCollection, string name, string description, object value, string uiTypeEditor)
 {
     IDTSCustomProperty100 property = propertyCollection.New();
     property.Name = name;
     property.Description = description;
     property.Value = value;
     if (!string.IsNullOrEmpty(uiTypeEditor))
     {
         property.UITypeEditor = uiTypeEditor;
     }
 }
Example #11
0
        /// <summary>
        /// Helper for adding a custom property to the provided collection
        /// </summary>
        /// <param name="customPropertyCollection"></param>
        /// <param name="name"></param>
        /// <param name="description"></param>
        /// <returns></returns>
        private IDTSCustomProperty100 createCustomProperty(IDTSCustomPropertyCollection100 customPropertyCollection, string name, string description, dynamic defaultValue = null)
        {
            IDTSCustomProperty100 customProperty = customPropertyCollection.New();

            customProperty.Description    = description;
            customProperty.Name           = name;
            customProperty.Value          = defaultValue;
            customProperty.ExpressionType = DTSCustomPropertyExpressionType.CPET_NOTIFY;

            return(customProperty);
        }
        public static object GetCustomPropertyValue(string propertyName, IDTSCustomPropertyCollection100 propertyCollection)
        {
            IDTSCustomProperty100 obj = GetCustomProperty(propertyName, propertyCollection);

            if (obj != null)
            {
                return(obj.Value);
            }

            return(null);
        }
        public DTSValidationStatus ValidateProperties(IDTSCustomPropertyCollection100 customPropertyCollection, DTSValidationStatus oldStatus)
        {
            DTSValidationStatus resultStatus = oldStatus;

            foreach (IDTSCustomProperty100 property in customPropertyCollection)
            {
                resultStatus = ValidatePropertyValue(property.Name, property.Value, resultStatus);
            }

            return(resultStatus);
        }
 public static void AddRange(this IDTSCustomPropertyCollection100 collection, IEnumerable <CustomProperty> properties)
 {
     foreach (var customProperty in properties)
     {
         var prop = collection.New();
         prop.ExpressionType = DTSCustomPropertyExpressionType.CPET_NOTIFY;
         prop.Name           = customProperty.Name;
         prop.Description    = customProperty.Description;
         prop.Value          = customProperty.Value;
     }
 }
        public DTSValidationStatus ValidateOutputColumnProperties(IDTSCustomPropertyCollection100 customPropertyCollection, DTSValidationStatus oldStatus)
        {
            DTSValidationStatus resultStatus = oldStatus;

            resultStatus = ValidatePropertyExists(customPropertyCollection, usageOfColumn, resultStatus);
            resultStatus = ValidatePropertyExists(customPropertyCollection, keyOutputColumnID, resultStatus);
            resultStatus = ValidatePropertyExists(customPropertyCollection, dotNetFormatString, resultStatus);
            resultStatus = ValidatePropertyExists(customPropertyCollection, isColumnOptional, resultStatus);
            resultStatus = ValidatePropertyExists(customPropertyCollection, nullResultOnConversionError, resultStatus);
            return(resultStatus);
        }
Example #16
0
        static protected void AddProperty(IDTSCustomPropertyCollection100 propertyCollection, string name, string description, object value, string uiTypeEditor)
        {
            IDTSCustomProperty100 property = propertyCollection.New();

            property.Name        = name;
            property.Description = description;
            property.Value       = value;
            if (!string.IsNullOrEmpty(uiTypeEditor))
            {
                property.UITypeEditor = uiTypeEditor;
            }
        }
        private void ScanCustomPropertiesCollection(IDTSCustomPropertyCollection100 properties, TreeNode parent)
        {
            // First check if we have a "FriendlyExpression". We use the value from FriendlyExpression, because it is CPET_NOTIFY
            // The related Expression will always be CPET_NONE, and less readable.
            bool friendlyExpressionValid = GetIsFriendlyExpression(properties);

            foreach (IDTSCustomProperty100 property in properties)
            {
                string propertyName = property.Name;
                string value        = property.Value as string;
                if (string.IsNullOrEmpty(value))
                {
                    continue;
                }

                string match;
                if (property.ExpressionType == DTSCustomPropertyExpressionType.CPET_NOTIFY)
                {
                    // Check the expression string for our matching variable name
                    // We ignore the Task level properties derived from these expressions, because here we have much more context.
                    // Could have expression properties (CPET_NOTIFY) entirely, call it Darren's OCD in action.
                    if (ExpressionMatch(value, out match))
                    {
                        // For the "FriendlyExpression" property, rename to be Expression
                        if (friendlyExpressionValid && property.Name == "FriendlyExpression")
                        {
                            propertyName = "Expression";
                        }

                        VariableFoundEventArgs info = new VariableFoundEventArgs();
                        info.Match = match;
                        OnRaiseVariableFound(info);
                        AddNode(parent, propertyName, GetImageIndex(IconKeyPropertyExpression), new PropertyExpression(propertyName, value, property.Value.GetType()), true);
                    }
                }
                else
                {
                    if (property.Name == "Expression" && friendlyExpressionValid)
                    {
                        continue;
                    }


                    if (PropertyMatch(propertyName, value, out match))
                    {
                        VariableFoundEventArgs info = new VariableFoundEventArgs();
                        info.Match = match;
                        OnRaiseVariableFound(info);
                        AddNode(parent, propertyName, GetImageIndex(IconKeyProperty), property, true);
                    }
                }
            }
        }
 private DTSValidationStatus ValidatePropertyExists(IDTSCustomPropertyCollection100 customPropertyCollection, string propertyName, DTSValidationStatus oldStatus)
 {
     foreach (IDTSCustomProperty100 property in customPropertyCollection)
     {
         if (property.Name == propertyName)
         {
             return(Utilities.CompareValidationValues(oldStatus, DTSValidationStatus.VS_ISVALID));
         }
     }
     this.PostError(MessageStrings.MissingProperty(propertyName));
     return(Utilities.CompareValidationValues(oldStatus, DTSValidationStatus.VS_ISCORRUPT));
 }
Example #19
0
        /// <summary>
        /// Adds the custom properties for specifying the mongo db connection and optional query parameters
        /// </summary>
        /// <param name="customPropertyCollection"></param>
        private void AddCustomProperties(IDTSCustomPropertyCollection100 customPropertyCollection)
        {
            var customProperty = createCustomProperty(customPropertyCollection, COLLECTION_NAME_PROP_NAME, "Name of collection to import data from");

            customProperty.UITypeEditor = typeof(CollectionNameEditor).AssemblyQualifiedName;

            createCustomProperty(customPropertyCollection, CONDITIONAL_FIELD_PROP_NAME, "Field name for conditional query");
            createCustomProperty(customPropertyCollection, CONDITION_FROM_PROP_NAME, "'From' value for conditional query");
            createCustomProperty(customPropertyCollection, CONDITION_TO_PROP_NAME, "'To' value for conditional query");
            createCustomProperty(customPropertyCollection, CONDITION_DOC_PROP_NAME, "Mongo query document for conditional query");
            createCustomProperty(customPropertyCollection, SAMPLE_SIZE_PROP_NAME, "The number of documents to sample for generating column metadata", DEFAULT_SAMPLE_SIZE);
            createCustomProperty(customPropertyCollection, SAMPLE_OFFSET_PROP_NAME, "The offset at which the sample begins", DEFAULT_SAMPLE_OFFSET);
        }
 public static void AddComponentProperties(IDTSCustomPropertyCollection100 propertyCollection)
 {
     AddCustomProperty(propertyCollection, IsUnicodePropName, MessageStrings.IsUnicodePropDescription, true);
     AddCustomProperty(propertyCollection, TreatEmptyStringsAsNullPropName, MessageStrings.TreatEmptyStringsAsNullDescription, true);
     AddCustomProperty(propertyCollection, CodePagePropName, MessageStrings.CodePagePropDescription, DefaultCodePage);
     AddCustomProperty(propertyCollection, TextQualifierPropName, MessageStrings.TextQualifierPropDescription, string.Empty, typeof(DelimiterStringConverter).AssemblyQualifiedName);
     AddCustomProperty(propertyCollection, HeaderRowDelimiterPropName, MessageStrings.HeaderRowDelimiterPropDescription, DefaultRowDelimiter, typeof(DelimiterStringConverter).AssemblyQualifiedName);
     AddCustomProperty(propertyCollection, HeaderRowsToSkipPropName, MessageStrings.HeaderRowsToSkipPropDescription, 0);
     AddCustomProperty(propertyCollection, DataRowsToSkipPropName, MessageStrings.DataRowsToSkipPropDescription, 0);
     AddCustomProperty(propertyCollection, ColumnNamesInFirstRowPropName, MessageStrings.ColumnNameInFirstRowPropDescription, false);
     AddCustomProperty(propertyCollection, ColumnDelimiterPropName, MessageStrings.ColumnDelimiterPropDescription, DefaultDelimiter, typeof(DelimiterStringConverter).AssemblyQualifiedName);
     AddCustomProperty(propertyCollection, RowDelimiterPropName, MessageStrings.RowDelimiterPropDescription, DefaultRowDelimiter, typeof(DelimiterStringConverter).AssemblyQualifiedName);
 }
        public static object GetPropertyValue(IDTSCustomPropertyCollection100 propertyCollection, string name)
        {
            for (int i = 0; i < propertyCollection.Count; i++)
            {
                IDTSCustomProperty100 property = propertyCollection[i];
                if (property.Name.Equals(name))
                {
                    return(property.Value);
                }
            }

            return(null);
        }
 public static void AddComponentProperties(IDTSCustomPropertyCollection100 propertyCollection)
 {
     AddCustomProperty(propertyCollection, IsUnicodePropName, MessageStrings.IsUnicodePropDescription, true);
     AddCustomProperty(propertyCollection, TreatEmptyStringsAsNullPropName, MessageStrings.TreatEmptyStringsAsNullDescription, true);
     AddCustomProperty(propertyCollection, CodePagePropName, MessageStrings.CodePagePropDescription, DefaultCodePage);
     AddCustomProperty(propertyCollection, TextQualifierPropName, MessageStrings.TextQualifierPropDescription, string.Empty, typeof(DelimiterStringConverter).AssemblyQualifiedName);
     AddCustomProperty(propertyCollection, HeaderRowDelimiterPropName, MessageStrings.HeaderRowDelimiterPropDescription, DefaultRowDelimiter, typeof(DelimiterStringConverter).AssemblyQualifiedName);
     AddCustomProperty(propertyCollection, HeaderRowsToSkipPropName, MessageStrings.HeaderRowsToSkipPropDescription, 0);
     AddCustomProperty(propertyCollection, DataRowsToSkipPropName, MessageStrings.DataRowsToSkipPropDescription, 0);
     AddCustomProperty(propertyCollection, ColumnNamesInFirstRowPropName, MessageStrings.ColumnNameInFirstRowPropDescription, false);
     AddCustomProperty(propertyCollection, ColumnDelimiterPropName, MessageStrings.ColumnDelimiterPropDescription, DefaultDelimiter, typeof(DelimiterStringConverter).AssemblyQualifiedName);
     AddCustomProperty(propertyCollection, RowDelimiterPropName, MessageStrings.RowDelimiterPropDescription, DefaultRowDelimiter, typeof(DelimiterStringConverter).AssemblyQualifiedName);
 }
        public static object GetPropertyValue(IDTSCustomPropertyCollection100 propertyCollection, string name)
        {
            for (int i = 0; i < propertyCollection.Count; i++)
            {
                IDTSCustomProperty100 property = propertyCollection[i];
                if (property.Name.Equals(name))
                {
                    return property.Value;
                }
            }

            return null;
        }
        public static Boolean SetPropertyValue(IDTSCustomPropertyCollection100 propertyCollection, string name, object value)
        {
            for (int i = 0; i < propertyCollection.Count; i++)
            {
                IDTSCustomProperty100 property = propertyCollection[i];
                if (property.Name.Equals(name))
                {
                    property.Value = value;
                    return(true);
                }
            }

            return(false);
        }
        public static Boolean SetContainsLineage(IDTSCustomPropertyCollection100 propertyCollection, string name, Boolean value)
        {
            for (int i = 0; i < propertyCollection.Count; i++)
            {
                IDTSCustomProperty100 property = propertyCollection[i];
                if (property.Name.Equals(name))
                {
                    property.ContainsID = value;
                    return(true);
                }
            }

            return(false);
        }
        public static string Get(this IDTSCustomPropertyCollection100 collection, PipelineComponent component, string name)
        {
            string value = collection[name].Value.ToString();

            if (value.StartsWith("@"))
            {
                var variableName = value.StartsWith("@[") ? value.Substring(2, value.Length - 3) : value.Substring(1);
                IDTSVariables100 variables;
                component.VariableDispenser.LockForRead(variableName);
                component.VariableDispenser.GetVariables(out variables);
                value = variables[variableName].Value.ToString();
            }
            return(value);
        }
        public static Boolean Contains(IDTSCustomPropertyCollection100 properties, String propertyName)
        {
            Boolean found = false;

            foreach (IDTSCustomProperty100 property in properties)
            {
                if (String.Compare(property.Name, propertyName, false) == 0)  // Case Sensitive!
                {
                    found = true;
                    break;
                }
            }

            return(found);
        }
        public static IDTSCustomProperty100 GetCustomProperty(string propertyName, IDTSCustomPropertyCollection100 propertyCollection)
        {
            Debug.Assert(propertyCollection != null);

            foreach (IDTSCustomProperty100 propertyObject in propertyCollection)
            {
                if (String.Compare(propertyObject.Name, propertyName, true,
                                   System.Globalization.CultureInfo.InvariantCulture) == 0)
                {
                    return(propertyObject);
                }
            }

            return(null);
        }
Example #29
0
        /// <summary>
        /// Sets the GUID
        /// </summary>
        /// <param name="guid">GUID</param>
        /// <param name="propCollection">custom property collection of the input column</param>
        public static void SetIdProperty(string guid, IDTSCustomPropertyCollection100 propCollection)
        {
            if (!NeedsMapping())
            {
                return;
            }

            try
            {
                propCollection[IdPropertyName].Value = guid;
            }
            catch
            {
                AddIdProperty(guid, propCollection);
            }
        }
Example #30
0
        /// <summary>
        /// Sets 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>
        public static void SetIdProperty(string guid, IDTSCustomPropertyCollection100 propCollection, PropertyType propType)
        {
            if (!NeedsMapping())
            {
                return;
            }

            try
            {
                propCollection[IdPorpertyNameList[(int)propType]].Value = guid;
            }
            catch
            {
                AddIdProperty(guid, propCollection, propType);
            }
        }
 private static void AddCustomProperty(IDTSCustomPropertyCollection100 propertyCollection, string name, string description, object value, string typeConverter)
 {
     IDTSCustomProperty100 property = propertyCollection.New();
     property.Name = name;
     property.Description = description;
     property.Value = value;
     property.ExpressionType = DTSCustomPropertyExpressionType.CPET_NOTIFY;
     if (value is string)
     {
         property.State = DTSPersistState.PS_PERSISTASHEX;
     }
     if (!string.IsNullOrEmpty(typeConverter))
     {
         property.TypeConverter = typeConverter;
     }
 }
        /// <summary>
        ///  Adds a custom property to a CustomPropertyCollection and sets the value
        ///  (has no effect if custom property already exists)
        /// </summary>
        /// <param name="propCollection">the CustomPropertyCollection</param>
        /// <param name="value">the value of the custom property</param>
        /// <param name="propertyName">the name of the custom property</param>
        private void AddCustomProperty(IDTSCustomPropertyCollection100 propCollection, string value, string propertyName)
        {
            IDTSCustomProperty100 prop = null;

            try
            {
                //do nothing if custom property exists:
                prop = propCollection[propertyName];
            }
            catch (Exception)
            {
                prop       = propCollection.New();
                prop.Name  = propertyName;
                prop.Value = value;
            }
        }
Example #33
0
        /// <summary>
        /// Removes the custom propert with the GUID
        /// </summary>
        /// <param name="propCollection">custom property collection of the input column</param>
        /// <param name="propType">>property type</param>
        public static void RemoveIdProperty(IDTSCustomPropertyCollection100 propCollection, PropertyType propType)
        {
            if (!NeedsMapping())
            {
                return;
            }

            try
            {
                propCollection.RemoveObjectByID(propCollection[IdPorpertyNameList[(int)propType]].ID);
            }
            catch (Exception)
            {
                //custom property does not exists
            }
        }
Example #34
0
        public static IDTSCustomProperty100 FindCustomPropertyByName(string name, IDTSCustomPropertyCollection100 customPropertyCollection, bool ignoreCase)
        {
            if (customPropertyCollection != null)
            {
                foreach (IDTSCustomProperty100 cp in customPropertyCollection)
                {
                    StringComparison comparisonType = ignoreCase ? StringComparison.InvariantCultureIgnoreCase : StringComparison.InvariantCulture;
                    if (cp.Name.Equals(name, comparisonType))
                    {
                        return(cp);
                    }
                }
            }

            return(null);
        }
        public DTSValidationStatus ValidateProperties(IDTSCustomPropertyCollection100 customPropertyCollection, DTSValidationStatus oldStatus)
        {
            DTSValidationStatus resultStatus = oldStatus;
            foreach (IDTSCustomProperty100 property in customPropertyCollection)
            {
                resultStatus = ValidatePropertyValue(property.Name, property.Value, resultStatus);
            }

            return resultStatus;
        }
Example #36
0
        private void AddCustomProperties(IDTSCustomPropertyCollection100 customPropertyCollection)
        {
            IDTSCustomProperty100 customProperty = createCustomProperty(customPropertyCollection, COLLECTION_NAME_PROP_NAME, "Name of collection to import data from");
            customProperty.UITypeEditor = typeof(CollectionNameEditor).AssemblyQualifiedName;

            customProperty = createCustomProperty(customPropertyCollection, CONDITIONAL_FIELD_PROP_NAME, "Field name for conditional query");

            createCustomProperty(customPropertyCollection, CONDITION_FROM_PROP_NAME, "'From' value for conditional query");
            createCustomProperty(customPropertyCollection, CONDITION_TO_PROP_NAME, "'To' value for conditional query");
            createCustomProperty(customPropertyCollection, CONDITION_DOC_PROP_NAME, "Mongo query document for conditional query");
        }
 private static void AddCustomProperty(IDTSCustomPropertyCollection100 propertyCollection, string name, string description, object defaultValue)
 {
     AddCustomProperty(propertyCollection, name, description, defaultValue, string.Empty);
 }
Example #38
0
        private IDTSCustomProperty100 createCustomProperty(IDTSCustomPropertyCollection100 customPropertyCollection, string name, string description)
        {
            IDTSCustomProperty100 customProperty = customPropertyCollection.New();
            customProperty.Description = description;
            customProperty.Name = name;

            return customProperty;
        }
Example #39
0
 public void ProvidePersistenceProperties(IDTSCustomPropertyCollection100 pIDTSCustomPropertyCollection)
 {
     _innerObject.ProvidePersistenceProperties(pIDTSCustomPropertyCollection);
 }
Example #40
0
        /// <summary>
        /// Adds the custom properties for specifying the mongo db connection and optional query parameters
        /// </summary>
        /// <param name="customPropertyCollection"></param>
        private void AddCustomProperties(IDTSCustomPropertyCollection100 customPropertyCollection)
        {
            var customProperty = createCustomProperty(customPropertyCollection, COLLECTION_NAME_PROP_NAME, "Name of collection to import data from");
            customProperty.UITypeEditor = typeof(CollectionNameEditor).AssemblyQualifiedName;

            createCustomProperty(customPropertyCollection, CONDITIONAL_FIELD_PROP_NAME, "Field name for conditional query");
            createCustomProperty(customPropertyCollection, CONDITION_FROM_PROP_NAME, "'From' value for conditional query");
            createCustomProperty(customPropertyCollection, CONDITION_TO_PROP_NAME, "'To' value for conditional query");
            createCustomProperty(customPropertyCollection, CONDITION_DOC_PROP_NAME, "Mongo query document for conditional query");
            createCustomProperty(customPropertyCollection, SAMPLE_SIZE_PROP_NAME, "The number of documents to sample for generating column metadata", DEFAULT_SAMPLE_SIZE);
            createCustomProperty(customPropertyCollection, SAMPLE_OFFSET_PROP_NAME, "The offset at which the sample begins", DEFAULT_SAMPLE_OFFSET);
        }
Example #41
0
 public void Save(IDTSObjectModel100 pIDTSObjectModel,
     IDTSCustomPropertyCollection100 pIDTSCustomPropertyCollection)
 {
     _innerObject.Save(pIDTSObjectModel, pIDTSCustomPropertyCollection);
 }
        public static object GetCustomPropertyValue(string propertyName, IDTSCustomPropertyCollection100 propertyCollection)
        {
            IDTSCustomProperty100 obj = GetCustomProperty(propertyName, propertyCollection);
            
            if (obj != null)
            {
                return obj.Value;
            }

            return null;
        }
        public static void SetCustomProperty(string propertyName, object value, IDTSCustomPropertyCollection100 propertyCollection)
        {
            Debug.Assert(propertyCollection != null);

            foreach (IDTSCustomProperty100 propertyObject in propertyCollection)
            {
                if (String.Compare(propertyName, propertyObject.Name, true) == 0)
                {
                    if (!propertyObject.Value.Equals(value))
                    {
                        propertyObject.Value = value;
                    }
                    
                    return;
                }
            }

            throw new Exception(string.Format(CultureInfo.CurrentUICulture, "Property {0} not found.", propertyName));
        }
        protected object GetPropertyValue(IDTSCustomPropertyCollection100 propertyCollection, String name)
        {
            for (int i = 0; i < propertyCollection.Count; i++)
            {
                IDTSCustomProperty100 property = propertyCollection[i];
                if (property.Name.Equals(name))
                {
                    return property.Value;
                }
            }

            bool cancelled;
            ComponentMetaData.FireError(E_FAIL, ComponentMetaData.Name, "Can't find property: " + name, string.Empty, 0, out cancelled);
            throw new COMException(string.Empty, E_FAIL);
        }
        public static IDTSCustomProperty100 GetCustomProperty(string propertyName, IDTSCustomPropertyCollection100 propertyCollection)
        {
            Debug.Assert(propertyCollection != null);

            foreach (IDTSCustomProperty100 propertyObject in propertyCollection)
            {
                if (String.Compare(propertyObject.Name, propertyName, true,
                    System.Globalization.CultureInfo.InvariantCulture) == 0)
                {
                    return propertyObject;
                }
            }

            return null;
        }
Example #46
0
 internal BipsProxyIDTSCustomPropertyCollection100(IDTSCustomPropertyCollection100 innerObject)
 {
     _innerObject = innerObject;
 }
Example #47
0
        /// <summary>
        /// Helper for adding a custom property to the provided collection
        /// </summary>
        /// <param name="customPropertyCollection"></param>
        /// <param name="name"></param>
        /// <param name="description"></param>
        /// <returns></returns>
        private IDTSCustomProperty100 createCustomProperty(IDTSCustomPropertyCollection100 customPropertyCollection, string name, string description, dynamic defaultValue = null)
        {
            IDTSCustomProperty100 customProperty = customPropertyCollection.New();
            customProperty.Description = description;
            customProperty.Name = name;
            customProperty.Value = defaultValue;

            return customProperty;
        }
Example #48
0
        public static IDTSCustomProperty100 FindCustomPropertyByName(string name, IDTSCustomPropertyCollection100 customPropertyCollection, bool ignoreCase)
        {
            if (customPropertyCollection != null)
            {
                foreach (IDTSCustomProperty100 cp in customPropertyCollection)
                {
                    StringComparison comparisonType = ignoreCase ? StringComparison.InvariantCultureIgnoreCase : StringComparison.InvariantCulture;
                    if (cp.Name.Equals(name, comparisonType))
                    {
                        return cp;
                    }
                }
            }

            return null;
        }