-
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 to the TraditionalBridge project. In your actual environment, you may have existing routines in existing libraries, in which case you would add references to those libraries in the Traditional Bridge project so that the TraditionalBridgeHost program is linked against those libraries, but for the purpose of this tutorial, we will start by adding the code for a single routine 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 routine.
-
In
Solution Explorerright-click on theTraditionalBridgeproject, selectAdd > New Folder, and name the folderMethods. -
Right-click on the
Modelsfolder, selectAdd > New Item....
Let's add the first routine that we will be exposing. It's a function that has no parameters:
-
In the
Add New Itemdialog, selectCode File, and set the name of the file toGenEnvironment.dblbefore clickingAdd. -
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 is a function with a single in parameter that will be used to pass the name of a logical name. The return value of the function will be the translation of that logical name in the traditional Synergy environment.
-
Right-click on the
Modelsfolder, selectAdd > New Item.... -
In the
Add New Itemdialog, selectCode File, and set the name of the file toGetLogicalName.dblbefore clickingAdd. -
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 Synergy DBL version number and operating system. ;; ;;***************************************************************************** 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.
The third routine we will add will be a subroutine with three parameters. The first two in parameters will be in parameters and used to pass numeric values, and the third parameter will be an out parameter. The routine will add the values of the first two parameters, storing the resulting value in the third parameter.
-
Right-click on the
Modelsfolder, selectAdd > New Item.... -
In the
Add New Itemdialog, selectCode File, and set the name of the file toAddTwoNumbers.dblbefore clickingAdd. -
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.
Your Methods folder should now contain three files:

Before we move on, let's make sure the project builds:
-
Right-click on the
TraditionalBridgeproject and selectBuild. -
Check the
Outputwindow and verify that the build was successful.
1>------ Build started: Project: TraditionalBridge, Configuration: Debug x64 ------
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
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