-
Notifications
You must be signed in to change notification settings - Fork 14
Tutorial 04 04 Add Traditional Bridge Routines

The next step in the process is to add the traditional Synergy routines that you want to expose as enpoints via Traditional Bridge. In your actual environment, you may have existing routines in existing libraries, in which case you would add references to those libraries in the TraditionalBridge project so that the TraditionalBridgeHost program would be linked against those libraries. But for this tutorial, we will add the code for sample routines directly in the TraditionalBridge project.
The first routine we will add has no parameters, but is a function that returns an alpha value. The return value will be the output from the Synergy %versn function.
-
In Visual Studio Solution Explorer, right-click the Methods folder (
TraditionalBridge > Source > Methods) and selectAdd > New Itemfrom the context menu. -
In the Add New Item dialog, select
Code File. Then set the name of the file toGetEnvironment.dbland clickAdd. -
Copy and paste the following code into the new source file:
;;***************************************************************************** ;; ;; Title: GetEnvironment.dbl ;; ;; Description: An example routine being exposed by Traditional Bridge. ;; Returns the Synergy DBL version number and operating system. ;; ;;***************************************************************************** function GetEnvironment, a proc freturn %versn endfunction -
Save the file.
Now let's add a second routine. This one will be a little more complicated because it has an in parameter that will be used to pass in the name of a logical. The return value of the function will be the translation of that logical name in the traditional Synergy environment.
-
Right-click the Methods folder and select
Add > New Item. -
In the Add New Item dialog, select
Code File, set the name of the file toGetLogicalName.dbl, and then clickAdd. -
Copy and paste the following code into the new source file:
;;***************************************************************************** ;; ;; Title: GetLogicalName.dbl ;; ;; Description: An example routine being exposed by Traditional Bridge. ;; Returns the translation of a logical name. ;; ;;***************************************************************************** function GetLogicalName, a required in aLogicalName, a stack record translation, a1024 length, i4 endrecord proc xcall getlog(aLogicalName,translation,length) if (length) freturn translation(1:length) freturn "" endfunction -
Save the file.
Now we'll add a third routine, which will have three parameters. The first two parameters are in parameters and are used to pass numeric values. The third parameter is an out parameter. The routine adds the values of the first two parameters and stores the resulting value in the third parameter.
-
Right-click the Methods folder and select
Add > New Item. -
In the Add New Item dialog, select
Code File, set the name of the file toAddTwoNumbers.dbl, and then clickAdd. -
Copy and paste the following code into the new source file:
;;***************************************************************************** ;; ;; Title: AddTwoNumbers.dbl ;; ;; Description: An example routine being exposed by Traditional Bridge. ;; Calculates and returns the sum of two numbers. ;; ;;***************************************************************************** subroutine AddTwoNumbers required in number1, n required in number2, n required out result, n proc result = number1 + number2 xreturn endsubroutine -
Save the file.
The Methods folder should now contain three files:

Now that we have traditional Synergy routines, let's add the SMC definitions for that code. These definitions are in the the BridgeMethods interface in the SMC we added in Add Traditional Bridge Project.
-
Open a Windows command prompt and navigate to the directory with the
.slnfile for your Harmony Core solution. Then enter the following command to open the Harmony Core GUI tool:harmonycore gui -
When the "Loading Solution" message disappears, select
Interfacesto open the Interfaces screen, and then clickAdd interfacesin the status bar. -
In the "Add interfaces" dialog, select
BridgeMethodsand then clickOK.BridgeMethodswill now be displayed on the Interfaces screen:
-
Select
File > Savefrom the menu to save the setting you just added.
Next topic: Add Dispatcher Classes
-
Tutorial 2: Building a Service from Scratch
- Creating a Basic Solution
- Enabling OData Support
- Configuring Self Hosting
- Entity Collection Endpoints
- API Documentation
- Single Entity Endpoints
- OData Query Support
- Alternate Key Endpoints
- Expanding Relations
- Postman Tests
- Supporting CRUD Operations
- Adding a Primary Key Factory
- Adding Create Endpoints
- Adding Upsert Endpoints
- Adding Patch Endpoints
- Adding Delete Endpoints
-
Harmony Core CLI Tool
-
OData Aware Tools
-
Advanced Topics
- CLI Tool Customization
- Adapters
- API Versioning
- Authentication
- Authorization
- Collection Counts
- Customization File
- Custom Field Types
- Custom File Specs
- Custom Properties
- Customizing Generated Code
- Deploying to Linux
- Dynamic Call Protocol
- Environment Variables
- Field Security
- File I/O
- Improving AppSettings Processing
- Logging
- Optimistic Concurrency
- Multi-Tenancy
- Publishing in IIS
- Repeatable Unit Tests
- Stored Procedure Routing
- Suppressing OData Metadata
- Traditional Bridge
- Unit Testing
- EF Core Optimization
- Updating a Harmony Core Solution
- Updating to 3.1.90
- Creating a new Release
-
Background Information