Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.

Welcome, Guest
Guest Settings

Thread: ANN: Cross-Platform Code Generation for mORMot ORM / SOA secure Clients

Permlink Replies: 1 - Last Post: Aug 28, 2014 9:02 AM Last Post By: Kevin Powick

Posts: 143
Registered: 2/17/02
ANN: Cross-Platform Code Generation for mORMot ORM / SOA secure Clients
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 25, 2014 1:25 PM
Current version of the main units of our Open Source mORMot framework target only Win32 and Win64 systems.
It allows to make easy self-hosting of mORMot servers for local business applications in any corporation, or pay cheap hosting in the Cloud, since mORMot CPU and RAM expectations are much lower than a regular IIS-WCF-MSSQL-.Net stack.

But in a Service-Oriented Architecture (SOA), you would probably need to create clients for platforms outside the Windows world, especially mobile devices.

A set of cross-platform client units has just been introduced in the CrossPlatform sub-folder of the source code repository.
It allows writing any client in modern object pascal language, for:

- Any version of Delphi, on any platform (with FireMonkey UI, on Mac OSX, or any mobile supported devices);
- FreePascal Compiler 2.7.1;
- Smart Mobile Studio 2.1, to create AJAX or mobile applications (via PhoneGap, if needed).

This series of articles will introduce you to mORMot's Cross-Platform abilities:

In short, you can generate a Delphi unit from any mORmot server, which let any Delphi application, including OSX, iPhone or Android platforms, to connect to this server.

A set of object pascal units will provide a solid and shared ground for the any kind of clients:
- Connection to a mORMot server via HTTP, with full REST support;
- Support of weak or default authentication to secure the transfer - see
- Definition of the TSQLRecord ORM class, using RTTI when available on Delphi or FreePascal, and generated code for Smart Mobile Studio;
- Remote CRUD operations, via JSON and REST, with a TSQLRestClientURI class, with the same methods as with the mORMot.pas framework unit;
- Optimized TSQLTableJSON class to handle a JSON result table, as returned by +mORMot+'s REST server ORM - see and for numbers about how our unit is much faster than DBXJSON;
- Batch process - see - for transactional and high-speed writes;
- Client-Server services via methods with parameters marshaling;
- Client-Server services via interfaces with parameters marshaling and instance-life time;
- Mapping of most supported field types, including e.g. ISO 8601 date/time encoding, BLOBs and TModTime/TCreateTime;
- Complex record types are also exported and consumed via JSON, on all platforms (for both ORM and SOA methods);
- Some cross-platform low-level functions and types definitions, to help share as much code as possible between your projects.

You can now write code like this on any Delphi client:

var Client: TSQLRestClientHTTP;
    people: TSQLRecord;
    i: integer;
    calc: ICalculator;
  Client := GetClient('localhost','User','synopse'); // connect and create a session on the server
  people := TSQLRecordPeople.Create; // create an ORM class
    for i := 1 to 200 do begin
      people.FirstName := 'First'+IntToStr(i);
      people.LastName := 'Last'+IntToStr(i);
      people.YearOfBirth := i+1800;
      people.YearOfDeath := i+1825;
      people.Sexe := TPeopleSexe(i and 1);
      assert(Client.Add(people,true)=i); // add one record
  calc := TServiceCalculator.Create(Client); // access to an ICalculator service
  for i := 1 to 200 do
    assert(calc.Add(i,i+1)=i*2+1); // call a remote interface-based service

Now, your mobile or OSX clients will be able to interact with any SQL database (our ORM supports SQLite3, Oracle, Jet/MSAccess, MS SQL, Firebird, DB2, PostgreSQL, MySQL and NexusDB), or even NoSQL database (it supports MongoDB or an in-memory engine).
And consume remote services defined as interface - just like in WCF, without the installation or configuration hell of this platform, since mORMot relies on the convention over configuration pattern.

Performance is very high, especially for database access, and scaling to thousands of concurrent users.
For Delphi 6 up to XE6, full Open Source project.

or download the documentation from

Hope you find it interesting!
Kevin Powick

Posts: 4
Registered: 1/18/01
Re: ANN: Cross-Platform Code Generation for mORMot ORM / SOA secure Clients
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 28, 2014 9:02 AM   in response to: Arnaud BOUCHEZ in response to: Arnaud BOUCHEZ
Amazing, Arnaud. You are a beast!

Kevin Powick
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02