Data Exchange uses the Managed Extensibility Framework (MEF) to manage system functions and user-defined functions. MEF facilitates Data Exchange to identify and extract all the user-defined functions which implement the interfaces and base classes provided by Data Exchange, through a function pool. When DDW or Runtime calls a particular function, MEF helps in identifying this function in the function pool and then executing the logic, thus making it easy to integrate the user-defined functions within Data Exchange. You can develop your own custom functions and then copy the output function for Data Exchange to use.
For more information about MEF, refer to Managed Extensibility Framework (MEF).
Note: A user-defined function should be thread safe.
The following are the classes in Data Exchange which you can inherit.
The following tables provide a detailed description of the classes and their composition.
Table 4. Function Class
Name of the Class | Class description | Sections | Function/ Parameter/Member Name | Description |
Function abstract class | This is the core class that you will inherit from. It is provided in the Unisys.CPF.DataExchange.Common.Expression namespace. It defines the properties as well as the methods to implement while writing the user-defined functions. | Constructors | public Function() | Initializes a new instance of the Function class of the user-defined category. |
Properties | Name | Gets or sets the function name, which will be displayed in the Name column of the Function panel in the Expression window in DDW. | ||
Body | Gets or sets the function signature. This property will be displayed in the Expression box in the Expression window in DDW. | |||
Description | Gets or sets the description of the function, which is displayed
in the Description column of the Function panel in the Expression window of DDW. It is also used as tooltip for
the function. Note: This property is optional and displays empty if not provided. | |||
ReturnTypeName | Gets or sets the string representation of the return type. This is an optional parameter and is displayed in the Return Type column of the Function panel in the Expression window in DDW. | |||
Methods | Execute(EvaluationMode, EvaluationValue[]) | Returns the result while executing the method. This is an abstract method, where the logic of the function is implemented. EvaluationMode indicates the mode where this function is executed and EvaluationValue[] provides the value of the parameters for the function, if there are any. |
Table 5. Evaluation Value Class
Name of the Class | Class description | Sections | Function/ Parameter/Member Name | Description |
EvaluationValue class | Defines the values for the expressions in the Expression box. | Constructor | EvaluationValue() | Initializes a new instance of the EvaluationValue class with ErrorType = EvaluationErrorType.None and ErrorMessage = string.empty. |
Properties | Value | Gets or sets the actual value, which is of object type. | ||
DataType | Gets or sets the data type of the value. This property must
be specified to let the system know how to handle the data when transforming
to the target data store. For more information, refer to Appendix B. Internal Data Types of Data Exchange. | |||
StringLength | Gets or sets the string reorientation length of the value. This must be specified for the character types. | |||
Precision | Gets or sets the precision of the data. This must be specified for the numeric types. | |||
Scale | Gets or sets the scale of the data. This must be specified for the numeric types. | |||
IsSigned | Gets or sets the indicator to notify if the data is signed or not. This must be specified for the numeric types. | |||
IsConstant | Gets or sets the indicator to notify if the data is constant or not. | |||
MaxValue | Gets or sets the maximum value of the type this function returns. It must be specified for the numeric types. | |||
MinValue | Gets or sets the minimum value of the type this function returns. It must be specified for the numeric types. | |||
ErrorType | Gets or sets the error type if the value returned by the function
contains some error. For more information, refer to Appendix C. Internal Defined Error Types for EvaluationValue. | |||
ErrorMessage | Gets or sets the error message if the value returned by the function contains some error. | |||
IsNullValue | Gets the indicator if the function returns a null value. | |||
NullValue | Static property. Gets an instance of EvaluationValue whose value is null. | |||
EvaluationMode enum | Specifies an enumeration for the mode while evaluating the expressions. | Members | Runtime | Evaluates the expression on the Runtime Service. |
DDWTest | Evaluates the expression on DDW when you click the Test button with the input values. | |||
DDWValidate | Evaluates the expression on DDW when you click the Validate button with the default values. |