TMS XData v1.0 released


We're pleased to introduce today TMS XData, another important part in the TMS Business Subscription line-up of tools & components to let you write better & faster business logic for local, Windows-only, cross-platform and multi-tier solutions, in short, the entire spectrum of Delphi applications you can develop.

TMS XData is a full-featured Delphi framework that allows you to create HTTP/HTTPS servers that exposes TMS Aurelius, our Delphi ORM, objects through REST/JSON calls. With JSON being the defacto language for data communication via internet, these objects can be consumed by Delphi desktop or mobile clients but also any other client written in other languages.

TMS XData builds upon TMS Sparkle, the framework that offers classes for high performance HTTP/HTTPS client and server services for Windows, Mac-OSX, iOS, Android. TMS Sparkle is fully cross-platform but uses behind the scenes platform native APIs for the best possible performance.

To see how TMS XData can help you build multi-tier applications that consume TMS Aurelius ORM objects, suppose you have an Aurelius class mapped like the following.

[Entity, Automapping]
TCustomer = class
strict private
FId: integer;
FName: string;
FTitle: string;
FBirthday: TDateTime;
FCountry: TCountry;
property Id: Integer read FId write FId;
property Name: string read FName write FName;
property Title: string read FTitle write FTitle;
property Birthday: TDateTime read FDateTime write FDateTime;
property Country: TCountry read FCountry write FCountry;

With just a few lines of code you can create an XData layer to expose those objects. Creating the XData HTTP server module is explained here.

You could retrieve an existing TCustomer with id equals to 3 using the following HTTP request, for example:

GET /tms/xdata/Customer(3) HTTP/1.1
Host: server:2001

And the JSON representation the customer will be returned in the body of HTTP response:

“$id”: 1,
“@xdata.type”: “XData.Default.Customer”,
“Id”: 3,
“Name”: “Maria Anders”,
“Title”: “Sales Representative”,
“Birthday”: “1980-05-20”,
“Country”: null

You can perform changes to objects through the REST interface, using POST method to create new objects, DELETE to remove objects, and PUT or PATCH to update the objects. The following example will change the value of Title property of the customer resource specified in previous example:

PATCH /tms/xdata/Customer(1) HTTP/1.1
Host: server:2001

“Title”: “Marketing Manager”

You can also perform queries on existing objects. The following example will retrieve all customers with country name equals to “USA”, ordered by customer's name.

GET /tms/xdata/Customer?$filter=Country/Name eq 'USA'&$orderby=Name&$top=10 HTTP/1.1
Host: server:2001

And server will return with a JSON array of objects containing all the filtered objects. You can use query paging to restrict the number of objects returned in each request.

There is much more to explore in this exciting new framework. You can get started by downloading the trial version for Delphi XE2.. XE6 at and check out the full documentation

Comments are closed.