Creating Code-Based Sets

Code-based Sets are queries that can result in collections of people or collections of other resource types protected by EmpowerID. Each code-based Set requires a Set Runtime, which is a custom implementation of the EmpowerID API that allows C# code to be used to return a collection of EmpowerID object types. This topic walks you through the process.

To create a code-based Set

  1. Log into Workflow Studio.
  2. From Solution Explorer (located to the left of the Workflow Studio IDE), select the Workspace node.

    The Workspace tree appears, displaying the packages and package items in your personal Workspace.

  3. In the Workspace tree, right-click the Package node of your choice and select Add New Item, then EmpowerID Set Runtime.
  4. In the Add New Set Runtime window that appears, in the Name text field, enter "Helpdesk Technicians" and click OK.

    Workflow Studio does the following:
    • Creates a Set Runtime folder inside the selected package node.
    • Adds a Helpdesk Technicians package item to the new folder.
    • Opens the C# Editor stubbed for the new Set Runtime in the Document Space, ready for you to add custom code.

    • Adds the HelpdeskTechnicians.cs class file to the Classes folder in the Code Tree (in the Toolbox to the right).

      All Set Runtime objects you create in Workflow Studio use the GetResults() method of the ISetRuntime interface in the TheDotNetFactory.Framework.People.Components namespace.

      The following image shows the new Helpdesk Technicians Set Runtime in Workflow Studio. 

  5. In the C# Editor, in the body of the GetResults() method, delete throw new NotImplementedException(); and replace it with code that does the following:
    • Creates a new instance of the TheDotNetFactory.Framework.People.Components.Person class, using the Find() method to find EmpowerID Person objects with a title of "Helpdesk Technician."
    • Creates a new instance of the TheDotNetFactory.Framework.People.Components.SetCompilation class.
    • Loops through the new instance of the Person class,
      adding each person returned by the Find() method to the new instance of the SetCompilation class, and
      writing the PersonGUID DisplayName of the SetCompilation class to the FriendlyName property for each person.
    • Returns the results of the collection.

      Here is what the code for the GetResults() method looks like:
      int totalCount = -1;
          E.TList<Person> people = Person.Find
               ("Title = Helpdesk Technician", 0, int.MaxValue, out totalCount);
          E.TList<SetCompilation> results = new E.TList<SetCompilation>();
          foreach (Person p in people)
               results.Add(new SetCompilation(){SystemIdentifier = p.PersonGUID.ToString(),DisplayName
              = p.FriendlyName});
              return results;

      If you use LINQ to return results, the SELECT statement cannot contain any characters that XML does not escape:






  6. In the toolbar just above the C# Editor, click the Compile button. Compiling the Set Runtime allows you to verify that your code contains no syntax errors.

    If successful, the Operations Log shows a message stating that the HelpdeskTechnicians.dll compiled successfully.

    If unsuccessful, details of the problem appear in the Error Message box at the bottom of the log.

  7. Click the Close button to close the Operations Log.

To compile and publish your code-based Set

  1. In the toolbar just above the C# Editor, click the Compile and Publish button to publish it.

    Publishing the Set Runtime to the Workflow Server(s) makes it available to EmpowerID as a manageable object that you can use in delegation.

  2. In the Set Runtime Publishing wizard that appears, click the Next button.

  3. Select the Enterprise Workflow Server to which you want to publish it and click Next.

  4. Click Next and follow the wizard to complete the publishing process.
  5. In the Set dialog that appears, click Yes. This lets you create a code-based Set to associate with the Set Runtime.

  6. In the Add Set dialog that appears, do the following:
    1. Enter HelpdeskTechniciansSet in the Name field.
    2. Enter Helpdesk Technicians in the Friendly Name and Description fields.
    3. Select EmpowerID Person from the Object Type drop-down.
    4. Select both Is Enabled and Compile Now.
    5. Enter the desired parameters for the compilation schedule and then click OK.

      At this point, the Add Set dialog looks similar to this.

  7. When prompted to restart one or more services, click Yes.
  8. In the Active Services window that appears, select the EmpowerID services and click Restart.

To use a code-based Set in any RBAC scenario, you must pair it with a SetGroup.


On this page