OutSystems.ExternalLibraries.SDK
1.3.1
Prefix Reserved
See the version list below for details.
dotnet add package OutSystems.ExternalLibraries.SDK --version 1.3.1
NuGet\Install-Package OutSystems.ExternalLibraries.SDK -Version 1.3.1
<PackageReference Include="OutSystems.ExternalLibraries.SDK" Version="1.3.1" />
paket add OutSystems.ExternalLibraries.SDK --version 1.3.1
#r "nuget: OutSystems.ExternalLibraries.SDK, 1.3.1"
// Install OutSystems.ExternalLibraries.SDK as a Cake Addin #addin nuget:?package=OutSystems.ExternalLibraries.SDK&version=1.3.1 // Install OutSystems.ExternalLibraries.SDK as a Cake Tool #tool nuget:?package=OutSystems.ExternalLibraries.SDK&version=1.3.1
ODC External Libraries SDK
Table of Contents
1. Overview
This SDK is part of the OutSystems Developer Cloud (ODC) External Logic feature that you use to extend your apps built in the OutSystems visual language with custom code.
Use of this SDK is the first step in extending an ODC app. You use it to decorate the code of a C# .NET 6 project with SDK attributes that map to OutSystems visual language elements.
2. Prerequisites
- .NET 6.0 SDK installed.
- An IDE that supports building .NET 6 projects. For example, Visual Studio, Visual Studio Code, and Jet Brains Rider.
- Basic knowledge of C# programming concepts.
3. Usage
You can start developing external logic for an ODC app from scratch or using one of the provided templates.
From scratch
Using Microsoft Visual Studio, for example:
From the Create a new project window select the Class Library template.
Give the project a name, for example
ClassLibrary1
. You must select .NET 6.0 (Long-term support) as the framework. Click Create.From the Solution Explorer pane, right-click on the project name and click Manage NuGet packages... Search for
OutSystems.ExternalLibraries.SDK
, select the result and click Install.Create a public interface containing the methods you want to expose as server actions to your ODC apps and libraries. Then decorate it with the
OSInterface
attribute. For example,using OutSystems.ExternalLibraries.SDK; namespace MyCompany { [OSInterface] public interface IMyLibrary { public string SayHello(string name); public string SayGoodbye(string name); } }
Create a public class implementing that interface. For example,
namespace MyCompany { public class MyLibrary : IMyLibrary { public string SayHello(string name) { return $"Hello, {name}"; } public string SayGoodbye(string name) { return $"Goodbye, {name}"; } } }
The exposed methods can only have:
- Basic .NET types:
string
,int
,long
,bool
,byte[]
,decimal
,float
,double
,DateTime
. - Structs decorated with the
OSStructure
attribute. - Lists (any type inheriting from IEnumerable) of any of the previous two types.
- Basic .NET types:
Once you are finished with the code, save the project and publish it. For example, right-click Solution ClassLibrary1 and click Open in Terminal. Run command
dotnet publish -c Release
.Zip the contents of publish output folder (normally this is, for example,
./ClassLibrary1/bin/Release/net6.0/publish/*
) to the root folder of a ZIP file called, for example,ExternalLibrary.zip
, the name of your external library.âšī¸ The maximum supported size of the ZIP file in 40MB.
Upload the ZIP file to the ODC Portal. See the External Logic feature documentation for guidance on how to do this.
From a template
IBAN (International Bank Account Number) checker: Basic version
Download and unzip the basic template file from the SDK GitHub repository.
Load the C# project file,
OutSystems.IbanChecker.csproj
, using a supported IDE.Files in the project:
IIbanChecker.cs: Defines a public interface named
IIbanChecker
, decorated with theOSInterface
attribute. The interface has a single method namedParse
, which takes an IBAN string value as input and returns anIban
struct.Parse
is exposed as a server action to your ODC apps and libraries.IbanChecker.cs: Defines a public class named
IbanChecker
that implements theIIbanChecker
interface. The class is a convenient wrapper for theIbanNet
library, an open-source library that provides functionality for parsing and validating IBANs. The class has a private field named_parser
, which is an instance of theIIbanParser
interface.Iban.cs Defines a struct named
Iban
, decorated with theOSStructure
attribute. The struct has four public properties:Country
,Bban
,BankIdentifier
, andBranchIdentifier
.Iban
is exposed as a structure to your ODC apps and libraries.
UML diagram:
Edit the code to meet your use case.
Run the Powershell script
generate_upload_package.ps1
to generateExternalLibrary.zip
. Rename as required.Upload the generated ZIP file to the ODC Portal. See the External Logic feature documentation for guidance on how to do this.
IBAN (International Bank Account Number) checker: Advanced version
Download and unzip the advanced template file from the GitHub repository.
Load the C# project file,
OutSystems.IbanChecker.csproj
, using a supported IDE.Files in the project:
IIbanChecker.cs: Defines a public interface named
IIbanChecker
decorated with theOSInterface
attribute. The interface has four methods:Parse
: Takes an IBAN string as input and returns anIban
struct.TryParse
: Attempts to parse an IBAN string as input and returns a boolean success indicator along with the parsedIban
struct.Validate
: Takes an IBAN string as input as checks it against a specific rule and a list of rejected countries.Format
: Takes anIban
struct and an optional format string as input and returns a formatted string representation of the IBAN.
Each method is exposed as a server action to your ODC apps and libraries.
IbanChecker.cs: Defines a public class named
IbanChecker
that implements theIIbanChecker
interface. The class is a convenient wrapper for theIbanNet
library, an open-source library that provides functionality for parsing and validating IBANs. The class contains private fields_parser
and_validator
, which are instances of theIIbanParser
andIIbanValidator
interfaces. The constructor initializes these instances for use in the class methods.Structures/Iban.cs Defines a struct named
Iban
, decorated with theOSStructure
attribute. The struct has four public properties:Country
,Bban
,BankIdentifier
, andBranchIdentifier
. It's exposed as a structure to your ODC apps and libraries.Structures/IbanCountry.cs Defines a struct named
IbanCountry
, decorated with theOSStructure
attribute. The struct has five public properties:TwoLetterISORegionName
,DisplayName
,NativeName
,EnglishName
, andDomesticAccountNumberExample
. It's exposed as a structure to your ODC apps and libraries.Structures/ValidationResult.cs Defines a struct named
ValidationResult
, decorated with theOSStructure
attribute. The struct has three public properties:AttemptedValue
,Country
, andError
. It's exposed as a structure to your ODC apps and libraries.CustomRules/RejectedCountriesRule.cs: Defines a custom IBAN validation rule,
RejectCountryRule
, to reject specified country codes. It also defines an associated error result class,CountryNotAcceptedError
, for handling rejected countries.
Edit the code to meet your use case.
Run the Powershell script
generate_upload_package.ps1
to generateExternalLibrary.zip
. Rename as required.Upload the generated ZIP file to the ODC Portal. See the External Logic feature documentation for guidance on how to do this.
4. Reference
The table below maps the .NET attributes exposed by the SDK to the corresponding OutSystems elements. Click the link embedded link for further information.
.NET attribute | OutSystems element | .NET attribute property (OutSystems element property) | |
---|---|---|---|
[OSInterface] |
External library | Name (Name)<br>Description (Description)<br>IconResourceName (Icon)<br>OriginalName (Source name used for key calculation) | |
[OSAction] |
Server action | Description (Description) <br>IconResourceName (Icon)<br>ReturnType (Output parameter type)<br>ReturnName (Output parameter name)<br>OriginalName (Source name used for key calculation) | |
[OSParameter] |
Input/output parameter | <br>DataType (DataType)<br>Description (Description)<br>OriginalName (Source name used for key calculation) | |
[OSStructure] |
Structure | <br>Description (Description)<br>OriginalName ([Source Name used for the key calculation]) | |
[OSStructureField] |
Structure attribute | <br>DataType (DataType)<br>Description (Description)<br>Length (Length)<br>Decimals (Decimals)<br>IsMandatory (IsMandatory)<br>OriginalName (Source name used for key calculation) | |
[OSIgnore] |
Use to decorate a public property/field within a .NET struct decorated with to specify that it shouldn't be exposed as an OutSystems Structure Attribute. |
5. Best Practices
App architecture using external logic
The server actions you build in the OutSystems visual language execute directly in the ODC Runtime, the same infrastructure as the app.
Server actions your apps consume through external logic are slightly different in that they execute outside of this Runtime infrastructure. Each time your app calls a server action exposed by an external library, it makes an HTTPS call to an external service. This adds a small latency to the execution time of the server action. You should consider this when building an ODC app that uses external logic: is there any way to minimize the number of calls to the server action(s)?
6. Troubleshooting
Upload errors
All validation of your external logic is done when uploading the ZIP file to the Portal.
Use the error page documentation for guidance.
7. License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.