◷ Reading Time: 1 minute
Using
If there is a type whose static members are required during the evaluation, it has to be registered by this command
- path
- Description: Full address of a type including namespace and type name. Or a ruleset address to a model.
- Mandatory: Yes
- Type: String
- name
- Description: If not specified, the last part of the path will be used, otherwise this can override the name of the type.
- Mandatory: No (it’s better to specify an assembly)
- Type: String
- assembly
- Description: Assembly name (including .dll) that has the type of implementation
- Mandatory: No
- Type: String
- function
- Description: Indicates if the path is an address to type holding multiple functions
- Mandatory: No
- Type: Boolean (true/false)
<Declaration>
<Using path="System.DateTime"/>
</Declaration>
Custom Type and Assembly
The following, will register type Entities.Publications.PublicationCollection in an assembly named entities.dll with a new name of List.
<Declaration>
<Using assembly="Entities.dll" path="Entities.Publications.PublicationCollection" name="List"/>
</Declaration>
The following will import a type MyNamespace.MyType in an assembly named MyAssembly.dll:
<Declaration>
<Using assembly="MyAssembly.dll" path="MyNamespace.MyType" />
</Declaration>
Which then allows you to call static members by referring to MyType in your logic.
Logic as Function
The following sample registers a procedural logic as a function in some other model.
<Declaration>
<Using path="DataAccessLogicProcedure.xml" function="true" return="list" name="loadDataFromDb" />
</Declaration>
This registers logic in the model called “DataAccessLogicProcedure” that has an output parameter named “list” as a function. So in the current context, you can use it as shown in the following format:
<Var value="result = loadDataFromDb('Select * from cars')" />