Square9Softworks / CallAssemblyExamples

Sample code for GlobalAction's Call Assembly Node
0 stars 5 forks source link

Support for Workflow specific Input IDs #8

Closed VertexGeneral closed 7 years ago

VertexGeneral commented 7 years ago

This updated code removes deserialization of the PropertyMapping.xml file to a class in favor of Linq queries directly to the PropertyMapping.xml file in the file system. The PropertyMapping.xml file still needs to live in the same folder location as the SQLSelectQuery.dll, however it now supports separate property mappings for individual workflows within a single property mapping file. You will still need to have one PropertyMapping.xml for GlobalCapture in the Capture Services folder and a separate one for GlobalAction in the GetSmart folder, but you can manage multiple workflows for each feature within a single mapping file for that feature.

The new XML sample below shows how the schema should be structured:

<?xml version="1.0" encoding="utf-8" ?>
<PropertyMapping>
  <PropertyMap>
    <WorkflowID>SAMPLE</WorkflowID>
    <ConnectionString>1</ConnectionString>
    <SqlStatement>2</SqlStatement>
    <ReturnValue>3</ReturnValue>
  </PropertyMap>
  <PropertyMap>
    <WorkflowID>eF37bs64D</WorkflowID>
    <ConnectionString>4</ConnectionString>
    <SqlStatement>5</SqlStatement>
    <ReturnValue>6</ReturnValue>
  </PropertyMap>
</PropertyMapping>

A user must create a workflow field in GlobalCapture or GlobalAction and set the field value to read WorkflowID=[ID], exactly as it reads in the PropertyMapping.xml file. For example:

WorkflowID=SAMPLE

With the above, the SQLSelectQuery.dll will find the WorkflowID in the Input dictionary and then check the PropertyMapping.xml for SAMPLE and find ConnectionString to be 1, SqlStatement to be 2, and ReturnValue to be 3.

NOTE: The ID you provide for the workflow is CASE SENSITIVE and can be any mixture of letters and numbers as seen in the second sample set. If the ID matches an ID in the PropertyMapping.xml file, then we get the property map for that workflow and use it to get our data from the Input dictionary. If it does not exist it will throw an exception when trying to set the connection or command values.

LAST NOTE: This does not support multiple WorkflowIDs in a single Global(Action/Capture) workflow. This will always grab the FIRST WorkflowID that is found in the Input dictionary. If the WorkflowID exists multiple times in the PropertyMapping.xml file it will also always grab the FIRST occurrence of the property map.

VertexGeneral commented 7 years ago

Per Brian, updating code to use deserialization of the xml.