The Generate and convert masking activity allows you to generate a value using an IGenerator implementation and convert it to another type before saving it to the database.
|Table of contents|
To use the Generate and convert masking activity, it must be placed inside a table masking activity or a similar activity that iterates over data. Once placed, a Select Types window will open where you must choose the TGeneratedValue type, i.e. the type you want to generate, and the TConvertedValue type, i.e. the type you want to convert the generated value to. Select Browse for Types... will open the Browse and Select a .Net Type window where you can seach for more types. After clicking OK, you can choose the property you want to mask, and then enter an instance of a generator you want to you to generate new values. You can create a new instance in as a part of the masking activity, or you can choose an instance from custom code. Lastly, you have to enter an expression that will convert you generated value to the desired output type.
Let's assume we want to randomly generate an account number. The type of the Number column in the Account table is varchar, so we have to convert the value to a string before we can save the record. We do this by first placing the Account masking activity into opened Package.xaml, placing the Generate and convert masking activity inside it. In the Select Types windows we choose Int32 as the TGeneratedValue and String as the TConvertedValue.
Figure 1: Select Types window
After selecting the value types, we choose the Number column. As the generator, we create a new instance of the RandomNumberGenerator, and set it to generate values between 1 and 100. We then need to create an expression that will convert the generated number to a string.
Figure 2: Generating and converting values
Note: Generally, convertors are defined through lambda expressions. To learn more about lambda expressions see lambda expressions.
|Property group||Property name||Description||Example|
|Input Properties||DataItemProperty||The property to mask.||Write
|Expression||Expression used to convert generated values.||
|Generator||Generator used to generate values.||
|Input: Filter||Filter||Expression used for filtering records - only filtered items will be masked.||
|SkipDefaultValues||If true, default values will be omitted in masking (i.e. null values are not masked).||
|Input: Repeating||RepeaterId||The id of the repeater that will be used to detect repeating and save results when masking item key repeats.||
|RepeatingKey||Key to use for repeating detection.||Write
|Misc||DisplayName||Display name of the activity in the workflow.||
|Result||Contains the masking definition object. It's a part of the masking infrastructure and should be ignored.||-|