-
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.
-
In
Solution Explorer
right-click on theTraditionalBridge
project, selectAdd > New Folder
, and name the folderMethods
. -
Right-click on the
Models
folder, 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 Item
dialog, selectCode File
, and set the name of the file toGenEnvironment.dbl
before 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:
-
Right-click on the
Models
folder, selectAdd > New Item...
. -
In the
Add New Item
dialog, selectCode File
, and set the name of the file toGetLogicalName.dbl
before 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.
And finally we will add a third routine. This one is a subroutine with three parameters, two in parameters and one out parameter:
-
Right-click on the
Models
folder, selectAdd > New Item...
. -
In the
Add New Item
dialog, selectCode File
, and set the name of the file toAddTwoNumbers.dbl
before 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
TraditionalBridge
project and selectBuild
. -
Check the
Output
window 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 Code Generator
-
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