I have a general question I'm hoping someone can answer about creating custom properties for use in a Data Flow Component.
Is it possible to create custom properties for use at the column level? I can create custom properties at the component level, no problem, but that does me no good.
I want to add two properties (Encrypt and Decrypt) to the Input Column metadata.
Say I have a collection of Input columns col1, col2, col3. As a developer, I would like to set col3's Encrypt value to true so, at run time, col3 gets encrypted before being loaded into a database.
I have successfully encrypted and decrypted using a custom component. Still, I used the values "e" and "d" in the column Description and then evaluated that Description during PreExecute. I set a state object based on the value of Description and add it to a collection that is processed during ProcessInput. I don't think using the Description is a good thing to do, and that is the need for the custom properties.
2条答案
按热度按时间a5g8bdjr1#
Do SSIS columns have custom properties?
The answer is yes. SSIS columns are objects that inherit the
IDTSColumn130
interface. As mentioned in the SSIS documentation , this interface contains a property calledCustomPropertyCollection
that contains the collection ofIDTSCustomProperty100
objects added to the input by the component.Some components add some custom property to the SSIS columns such as the Derived Column Transformation. As I know, a custom component called
FriendlyExpression
is used to store the expression in plain text form. But, there is no way to add custom properties in the Integration Services package designer (Visual Studio).How to add Custom Properties?
I think the only way is to create packages programmatically and edit those values or develop a custom SSIS component that adds these properties at runtime.
This is an example of reading the custom properties of a Derived Column transformation using C#. ( Reference )
Alternatives
You can store the columns metadata within an external data source (SQL, XML, ...) and load it at runtime. Or you can use the
Description
property as you mentioned in your question.9q78igpj2#
I usually add a JSON string to the comment section. You just need to set your own standard. When you do "SELECT" just always include the comments (obtainable from the schema), and then process the data on the script level by parsing the comment as a JSON object/string or whatever.