In the Code Designer, users can write and build code specifying the behavior of the control. This code is scripted in C#.

In the code environment, there are comments written in the code that suggest which objects or variables can be used to accomplish certain tasks. These comments are intended to help programmers understand how the code works and to make modifications or additions to the code more easily.

Debugging Code with Debugger.Break()
  • “if (Debugger.IsAttached) — Debugger.Break()” is a line of code that is currently commented out in the code environment. When uncommented, it causes the code to break at that point when the code is run in Visual Studio’s debugger.
    • In order for the code to break at that point when using the Visual Studio debugger, the programmer needs to have Visual Studio open and running, and they need to have attached the debugger to the process that is running the code.

There are two main types of objects used in form and application building: DomainObjects and FormObjects.

  1. DomainObjects

A DomainObject is an object that represents an entity within the domain of the application. It is typically used to to manage business logic and data, and it represents the encapsulated data and behavior associated with a specific entity in the domain.

Here are some examples of code for creating, retrieving, updating, and saving DomainObjects:

Create DomainObject
  • To create a DomainObject, the following method should be called together with the application name and entity name:
    • var project = bpmAppService.BPMSServices.DomainObjectService.CreateDomainObject();
Retrieve DomainObject
  • To retrieve a domain object for a specific entity, use the code below, where “Id” is the identifier of the entity.
    • var pCostSummary = bpmAppService.BPMSServices.DomainObjectService.GetDomainObject(Id);
Save DomainObject
  • To save a domain object, use:
    • bpmAppService.BPMSServices.DomainObjectService.SaveDomainObject(domainObjectname);
Update DomainObject
  • To update a domain object, use:
    • bpmAppService.BPMSServices.DomainObjectService.UpdateDomainObject(domainObjectname);
Commit All Saved and Updated DomainObjects
  • To commit all saved and updated domain objects, use:
    • bpmAppService.UnitOfWork.CommitTransaction();
    • bpmAppService.UnitOfWork.CommitTransaction(false);
  1. FormObjects

A FormObject is an object that represents a user interface (UI) element, such as a label, textbox, button, or dropdown. It provides a way for users to interact with the data stored in the DomainObjects. Typically, FormObjects are used to capture user input or display information to the user.

To create a form object, take the following steps:

  • In the Form Entity tab of the Form Designer, add a new field by right-clicking on the form entity and select New Field from the context menu.
  • In the properties of the newly added field, provide the Name (which is used to reference the field in code), the Title (which is displayed to the user), and the Data Type (which defines the type of data that the field will hold, such as text, numbers, dates, etc.).
  • If the FormObject will reference data from another form or entity, select the Complex Type checkbox.
    • This will indicate that the field is more than a simple data type and needs to be linked to other data.
  • If the FormObject will hold a list of data, select the Is a List checkbox.
    • This will indicate that the field needs to be able to hold multiple instances of the data type, effectively creating a list of data.