/// <summary> /// Sets HashColumn default properties /// </summary> /// <param name="hashColumn">HashColumn which properties should be set</param> internal static void SetHashColumnProperties(HashColumnsTransformation.HashOuputColumnProperties propsToSet, IDTSOutputColumn hashColumn, HashColumnsTransformation.HashType hashTYpe) { SetHashColumnProperties(propsToSet, hashColumn, HashColumnsTransformation.HashType.MD5, HashColumnsTransformation.HashImplementationType.BinarySafe, HashColumnsTransformation.HashOutputDataType.DT_BYTES, 0); }
public static void SetHashColumnProperties(HashColumnsTransformation.HashOuputColumnProperties propsToSet, IDTSOutputColumn hashColumn, HashColumnsTransformation.HashType hashType, HashColumnsTransformation.HashImplementationType implementation, HashColumnsTransformation.HashOutputDataType dataType, int locale) { List <int> propsToRemove = new List <int>(); foreach (IDTSCustomProperty prop in hashColumn.CustomPropertyCollection) { if ( (prop.Name == Resources.HashAlgorithmPropertyName && (propsToSet & HashColumnsTransformation.HashOuputColumnProperties.HashAlgorithm) == HashColumnsTransformation.HashOuputColumnProperties.HashAlgorithm) || (prop.Name == Resources.HashColumnHashInputColumnsPropertyName && (propsToSet & HashColumnsTransformation.HashOuputColumnProperties.HashColumns) == HashColumnsTransformation.HashOuputColumnProperties.HashColumns) || (prop.Name == Resources.HashColumnHashFieldSeparatorPropertyName && (propsToSet & HashColumnsTransformation.HashOuputColumnProperties.HashFieldSeparator) == HashColumnsTransformation.HashOuputColumnProperties.HashFieldSeparator) || (prop.Name == Resources.HashColumnHashImplementationTypePropertyName && (propsToSet & HashColumnsTransformation.HashOuputColumnProperties.HashImplementationType) == HashColumnsTransformation.HashOuputColumnProperties.HashImplementationType) || (prop.Name == Resources.HashColumnNullReplacementValue && (propsToSet & HashColumnsTransformation.HashOuputColumnProperties.HashNullReplacement) == HashColumnsTransformation.HashOuputColumnProperties.HashNullReplacement) || (prop.Name == Resources.HashColumnStringTrimmingPropertyName && (propsToSet & HashColumnsTransformation.HashOuputColumnProperties.TrimStrings) == HashColumnsTransformation.HashOuputColumnProperties.TrimStrings) ) { propsToRemove.Add(prop.ID); } } foreach (int id in propsToRemove) { hashColumn.CustomPropertyCollection.RemoveObjectByID(id); } if ((propsToSet & HashColumnsTransformation.HashOuputColumnProperties.HashAlgorithm) == HashColumnsTransformation.HashOuputColumnProperties.HashAlgorithm) { //as the Output columns are Hash Columns, add HashType property with default MD5 IDTSCustomProperty hashAlgorithm = hashColumn.CustomPropertyCollection.New(); hashAlgorithm.Description = Resources.HashTypePropertyDescription; hashAlgorithm.Name = Resources.HashAlgorithmPropertyName; hashAlgorithm.ContainsID = false; hashAlgorithm.EncryptionRequired = false; hashAlgorithm.ExpressionType = DTSCustomPropertyExpressionType.CPET_NONE; hashAlgorithm.TypeConverter = typeof(HashColumnsTransformation.HashType).AssemblyQualifiedName; hashAlgorithm.Value = hashType; } if ((propsToSet & HashColumnsTransformation.HashOuputColumnProperties.HashImplementationType) == HashColumnsTransformation.HashOuputColumnProperties.HashImplementationType) { IDTSCustomProperty hashImplementation = hashColumn.CustomPropertyCollection.New(); hashImplementation.Description = "Implementation version of the Hash Type"; hashImplementation.Name = Resources.HashColumnHashImplementationTypePropertyName; //"HashImplementationType"; hashImplementation.ContainsID = false; hashImplementation.EncryptionRequired = false; hashImplementation.ExpressionType = DTSCustomPropertyExpressionType.CPET_NONE; hashImplementation.TypeConverter = typeof(HashColumnsTransformation.HashImplementationType).AssemblyQualifiedName; hashImplementation.Value = implementation; } if ((propsToSet & HashColumnsTransformation.HashOuputColumnProperties.HashColumns) == HashColumnsTransformation.HashOuputColumnProperties.HashColumns) { IDTSCustomProperty hashColumns = hashColumn.CustomPropertyCollection.New(); hashColumns.Description = "List of input columns to build HASH"; hashColumns.Name = Resources.HashColumnHashInputColumnsPropertyName; // "HashInputColumns"; hashColumns.ContainsID = true; hashColumns.EncryptionRequired = false; hashColumns.ExpressionType = DTSCustomPropertyExpressionType.CPET_NONE; hashColumns.Value = string.Empty; } if ((propsToSet & HashColumnsTransformation.HashOuputColumnProperties.HashFieldSeparator) == HashColumnsTransformation.HashOuputColumnProperties.HashFieldSeparator) { IDTSCustomProperty hashFieldSeparator = hashColumn.CustomPropertyCollection.New(); hashFieldSeparator.Description = "Specifies the field separator for Unicode String Implementations"; hashFieldSeparator.Name = Resources.HashColumnHashFieldSeparatorPropertyName; hashFieldSeparator.ContainsID = false; hashFieldSeparator.EncryptionRequired = false; hashFieldSeparator.ExpressionType = DTSCustomPropertyExpressionType.CPET_NONE; hashFieldSeparator.Value = DefaultFieldtSeparator; } if ((propsToSet & HashColumnsTransformation.HashOuputColumnProperties.HashNullReplacement) == HashColumnsTransformation.HashOuputColumnProperties.HashNullReplacement) { IDTSCustomProperty hashFieldSeparator = hashColumn.CustomPropertyCollection.New(); hashFieldSeparator.Description = "Specifies the NULL replacement value for non NULL safe Unicode String Implementations"; hashFieldSeparator.Name = Resources.HashColumnNullReplacementValue; hashFieldSeparator.ContainsID = false; hashFieldSeparator.EncryptionRequired = false; hashFieldSeparator.ExpressionType = DTSCustomPropertyExpressionType.CPET_NONE; hashFieldSeparator.Value = DefaultNullReplacement; } if ((propsToSet & HashColumnsTransformation.HashOuputColumnProperties.TrimStrings) == HashColumnsTransformation.HashOuputColumnProperties.TrimStrings) { IDTSCustomProperty stringTrimming = hashColumn.CustomPropertyCollection.New(); stringTrimming.Description = "Specifies whether and how string values should be trimmed"; stringTrimming.Name = Resources.HashColumnStringTrimmingPropertyName; stringTrimming.ContainsID = false; stringTrimming.EncryptionRequired = false; stringTrimming.ExpressionType = DTSCustomPropertyExpressionType.CPET_NONE; stringTrimming.TypeConverter = typeof(HashColumnsTransformation.StringTrimming).AssemblyQualifiedName; stringTrimming.Value = HashColumnsTransformation.StringTrimming.None; } if ( ((propsToSet & HashColumnsTransformation.HashOuputColumnProperties.HashAlgorithm) == HashColumnsTransformation.HashOuputColumnProperties.HashAlgorithm) ) { //Set data type for the column accordingly with the hashType - default for MD4 SetHashColumnDataType(hashType, hashColumn, locale); } }
/// <summary> /// Sets HashColumn default properties /// </summary> /// <param name="hashColumn">HashColumn which properties should be set</param> internal static void SetHashColumnProperties(HashColumnsTransformation.HashOuputColumnProperties propsToSet, IDTSOutputColumn hashColumn) { SetHashColumnProperties(propsToSet, hashColumn, HashColumnsTransformation.HashType.MD5); }