Generating C# Object API Code Using Sybase Unwired WorkSpace

Use Sybase Unwired WorkSpace to generate object API code containing mobile business object (MBO) references.

Prerequisites

Develop the MBOs that will be referenced in the device applications you are developing. A mobile application project must contain at least one non-online MBO. You must have an active connection to the datasources to which the MBOs are bound.

Task
Unwired Platform provides the Code Generation wizard for generating object API code. Code generation creates the business logic, attributes, and operations for your mobile business object.
  1. Launch the Code Generation wizard.
    From Action
    Mobile Application Diagram Right-click within the Mobile Application Diagram and select Generate Code.
    WorkSpace Navigator Right-click the Mobile Application project folder that contains the mobile objects for which you are generating API code, and select Generate Code.
  2. (Optional; this page of the code generation wizard is seen only if you are using the Advanced developer profile) Enter the information for these options, then click Next:
    Option Description
    Select code generation configuration Select one of:
    • Continue without a configuration – generate device code without using a configuration.
    • Select an existing configuration – either select an existing configuration from which you generate device client code, or create a new configuration. By default, a configuration named Most recent configuration is available.Selecting this option enables:
      • Select code generation configuration – lists any existing configurations, from which you can select and use for this session. You can also delete any existing saved configurations.
      • Create new configuration by clicking the Add button. In the dialog, enter the Name of the new configuration and provide a description, and click Create to save the configuration for future sessions.

        Select an existing configuration as a starting point for this session and click Clone to modify the configuration.

  3. On the Select Mobile Objects page, select all the MBOs in the mobile application project or select MBOs under a specific synchronization group, for which references, metadata, and dependencies (referenced MBOs) are included in the generated device code. Then click Next.
    Dependent MBOs are automatically added (or removed) from the Dependencies section depending on your selections.
    Note: Code generation fails if the server-side (runtime) enterprise information system (EIS) data sources referenced by the MBOs in the project are not running and available to connect to when you generate object API code.
  4. Enter the information for these configuration options:
    Option Description
    Language Select C#.
    Platform Select the platform ( target device) for which the device client code is intended.
    • NET Framework for Windows
    • NET Compact Framework 3.5 for Windows Mobile
    Unwired Server Specify a default Unwired Server connection profile to which the generated code connects at runtime.
    Server domain

    Choose the domain to which the generated code connects. By default, if you specified an Unwired Server to which you previously connected successfully, the first domain in the list is chosen. Accept this domain, or enter a different one.

    Note: This field is enabled only when an Unwired Server is selected.
    Page size

    (Optional) Select the page size for the generated client code. If you do not set the page size, the default is 16K at runtime, which is proposed based on the selected MBO's attributes.

    The page size should be larger than the sum of all attribute lengths (a binary length greater than 32767 is converted to a binary large object (BLOB), and is not included in the sum; a string greater than 8191 is converted to a character large object (CLOB), and is also not included) for any MBO that is included. If an MBO attribute's length sum is greater than the page size, some attributes automatically convert to BLOB or CLOB, and therefore cannot be put into a where clause.

    Note: This field is only enabled when an Unwired Server is selected.
    Destination Specify the destination of the generated device client files. Enter (or Browse) to a Project path or File system path (Mobile Application project) location, and select Generated Code as the destination.

    Select Clean up destination before code generation to clean up the destination folder before generating the device client files.

      If you select Java as the language, enter, or browse to the , which adds it to the project build path, and prevents errors after code generation.
  5. Select Generate metadata classes to generate metadata for the attributes and operations of each generated client object.
    The Including object manager classes option is only available if you select Generate metadata classes.
  6. Click Finish.
  7. Examine the generated code location and contents.
  8. Validate the generated code.