In order to enhance code modularity, we extracted logging and testing features from SynCommons.pas. Discover the new SynLog.pas and SynTests.pas units! Documentation has been updated to reflect the changes. This is a breaking change... Ensure you add SynLog and/or SynTests to your uses clauses, just […]
Tag - Documentation
2014-11-23
Breaking change: New SynLog and SynTests unit extracted from SynCommons.pas
2014-11-23. Open Source › Open Source libraries
2014-11-20
BeDelphi 2014 Slides
2014-11-20. Open Source › mORMot Framework
We just finished our Be-Delphi 2014 sessions and drank our last beers, so
here we are.
I published some slides for this great event.
2014-11-14
BREAKING CHANGE - TSQLRecord.ID primary key changed to TID: Int64
2014-11-14. Open Source › mORMot Framework
Up to now, the TSQLRecord.ID
property was defined in
mORMot.pas
as a plain
PtrInt
/NativeInt
(i.e. Integer
under
Win32), since it was type-cast as pointer for TSQLRecord
published
properties.
We introduced a new TID
type, so that the ORM primary key would
now be defined as Int64
.
All the framework ORM process relies on the TSQLRecord
class.
This abstract TSQLRecord
class features a lot of built-in methods,
convenient to do most of the ORM process in a generic way, at record level.
It first defines a primary key field, defined as ID:
TID
, i.e. as Int64
in mORMot.pas
:
type TID = type Int64; ... TSQLRecord = class(TObject) ... property ID: TID read GetID write fID; ...
In fact, our ORM relies now on a Int64
primary key, matching
the SQLite3 ID
/RowID
primary key.
This primary key will be used as RESTful resource
identifier, for all CRUD operations.
Automatic TSQLRecord memory handling
2014-11-14. Open Source › mORMot Framework
Working with objects is pretty powerful, but requires to handle manually the
created instances life time, via try
.. finally
blocks. Most of the time, the TSQLRecord
life time would be very
short: we allocate one instance on a local variable, then release it when it
goes out of scope.
If we take again the TSQLBaby
sample, we may write:
function NewMaleBaby(Client: TSQLRest; const Name,Address: RawUTF8): TID; var Baby: TSQLBaby; // store a record begin Baby := TSQLBaby.Create; try Baby.Name := Name; Baby.Address := Address; Baby.BirthDate := Date; Baby.Sex := sMale; result := Client.Add(Baby); finally Baby.Free; end; end;
To ease this pretty usual pattern, the framework offers some kind of
automatic memory management at TSQLRecord
level:
function NewMaleBaby(Client: TSQLRest; const Name,Address: RawUTF8): TID; var Baby: TSQLBaby; // store a record begin TSQLBaby.AutoFree(Baby); // no try..finally needed! Baby.Name := Name; Baby.Address := Address; Baby.BirthDate := Date; Baby.Sex := sMale; result := Client.Add(Baby); end; // local Baby instance will be released here
2014-11-05
mORMot documentation as web
2014-11-05. Open Source › mORMot Framework
We have enhanced our SynProject Open Source tool, so that it is now able to generate its documentation as HTML, in addition to doc/pdf documents. You can take a look at this web page. It contains the whole SAD 1.18 content. The pdf is more than 16 MB, whereas this html page is only 6MB. Note that […]
2014-10-25
Are "Micro Services" the proper way of writing SOA?
2014-10-25. Open Source › mORMot Framework
I just wanted to share a great article by Martin Fowler, about Micro Services. IMHO such "Micro Services" are the proper way of defining a SOA project, following SOLID principles. If we follow the "Single Responsibility" principle, we will define small uncoupled services, which […]
2014-10-24
MVC/MVVM Web Applications
2014-10-24. Open Source › mORMot Framework
We almost finished implementing a long-standing feature request,
introducing MVC / MVVM for Web Applications (like RubyOnRails) in mORMot.
This is a huge step forward, opening new perspectives not only to our
framework, but for the Delphi community.
In respect to the existing
MVC frameworks for Delphi, our solution is closer to Delphi On Rails (by the
convention-over-configuration
pattern) than the Delphi MVC
Framework or XMM.
The mORMot point of view is unique, and quite powerful,
since it is integrated with other parts of our framework, as its ORM/ODM or interface-based services.
Of course, this is a work in progress, so you are welcome to put your feedback,
patches or new features!
We will now explain how to build a MVC/MVVM web application using
mORMot, starting from the "30
- MVC Server" sample.
First of all,
check the source in our GitHub repository: two .pas
files, and
a set of minimalist Mustache
views.
This little web application publishes a simple BLOG, not fully finished yet
(this is a Sample, remember!).
But you can still execute it in your desktop browser, or any mobile device
(thanks to a simple Bootstrap-based responsive design), and see the
articles list, view one article and its comments, view the author information,
log in and out.
This sample is implemented as such:
MVVM | Source | mORMot |
Model | MVCModel.pas |
TSQLRestServerDB ORM over a SQlite3 database |
View | *.html |
Mustache template engine in the Views sub-folder |
ViewModel | MVCViewModel.pas |
Defined as one IBlogApplication interface |
For the sake of the simplicity, the sample will create some fake data in its own local SQlite3 database, the first time it is executed.
2014-09-12
Legacy code, mORMot, and database sharing
2014-09-12. Open Source › mORMot Framework
It is pretty much possible that you would have to maintain and evolve a legacy project, based on an existing database, with a lot of already written SQL statements - see Legacy code and existing projects.
For instance, you would like to use mORMot for new features, and/or
add mobile or HTML clients - see Cross-Platform
clients.
In this case, the ORM advanced features - like ORM Cache or BATCH process, see
BATCH
sequences for adding/updating/deleting records - may conflict with the
legacy code, for the tables which may have to be shared.
Here are some guidelines when working on such a project.
To be exhaustive about your question, we need to consider each ORM CRUD
operation.
We may have to divide them in three kinds: read queries, insertions, and
modifications of existing data.
2014-08-11
Cross-Platform mORMot Clients - Smart Mobile Studio
2014-08-11. Open Source › mORMot Framework

Current version of the main framework units 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 is therefore available 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 (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:
- Units and platforms;
- Generating the client code wrappers;
- Delphi / FreePascal clients;
- Smart Mobile Studio clients.
Any feedback is welcome in our forum, as usual!
Cross-Platform mORMot Clients - Delphi / FreePascal
2014-08-11. Open Source › mORMot Framework

Current version of the main framework units 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 is therefore available 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 (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:
- Units and platforms;
- Generating the client code wrappers;
- Delphi / FreePascal clients;
- Smart Mobile Studio clients.
Any feedback is welcome in our forum, as usual!
Cross-Platform mORMot Clients - Generating Code Wrappers
2014-08-11. Open Source › mORMot Framework

Current version of the main framework units 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 is therefore available 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 (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:
- Units and platforms;
- Generating the client code wrappers;
- Delphi / FreePascal clients;
- Smart Mobile Studio clients.
Any feedback is welcome in our forum, as usual!
Cross-Platform mORMot Clients - Units and Platforms
2014-08-11. Open Source › mORMot Framework

Current version of the main framework units 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 is therefore available 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 (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:
- Units and platforms;
- Generating the client code wrappers;
- Delphi / FreePascal clients;
- Smart Mobile Studio clients.
Any feedback is welcome in our forum, as usual!
2014-08-05
Returning content as XML
2014-08-05. Open Source › mORMot Framework
By default, interface-based services of a mORMot server will always
return a JSON array (or a JSON object, if
TServiceFactoryServer.ResultAsJSONObject
is
true
).
With some kind of clients (e.g. if they are made by a third party), it could be
useful to return XML content instead.
Your mORMot server is able to let its interface-based services return XML context instead, or in addition to the default JSON format.
2014-06-22
Audit-trail for ORM change tracking
2014-06-22. Open Source › mORMot Framework
Since most CRUD operations are centered within the scope of our
mORMot server, we implemented in the ORM an integrated mean of
tracking changes (aka Audit Trail) of any TSQLRecord
.
In short, our ORM is transformed into a time-machine, just like the good old
DeLorean!
Keeping a track of the history of business objects is one very common need
for software modeling, and a must-have for any accurate data modeling,
like Domain-Driven Design.
By default, as expected by the OOP model, any change to an object will forget
any previous state of this object. But thanks to mORMot's exclusive
change-tracking feature, you can persist the history of your objects.
Enabling audit-trail
By default, change-tracking feature will be disabled, saving performance and
disk use.
But you can enable change tracking for any class, by calling the following
method, on server side:
aServer.TrackChanges([TSQLInvoice]);
This single line will let aServer: TSQLRestServer
monitor all
CRUD operations, and store all changes of the TSQLInvoice
table
within a TSQLRecordHistory
table.
2014-06-09
Performance comparison from Delphi 6, 7, 2007, XE4 and XE6
2014-06-09. Pascal Programming
Since there was recently some articles about performance comparison between several versions of the Delphi compiler, we had to react, and gives our personal point of view.
IMHO there won't be any definitive statement about this.
I'm always doubtful about any conclusion which may be achieved with such kind
of benchmarks.
Asking "which compiler is better?" is IMHO a wrong question.
As if there was some "compiler magic": the new compiler will be just like a new
laundry detergent - it will be cleaner and whiter...
Performance is not about marketing.
Performance is an iterative process, always a matter of circumstances,
and implementation.
Circumstances of the benchmark itself.
Each benchmark will report only information about the process it
measured.
What you compare is a limited set of features, running most of the time an
idealized and simplified pattern, which shares nothing with real-world
process.
Implementation is what gives performance.
Changing a compiler will only gives you some percents of time change.
Identifying the true bottlenecks of an application via a profiler, then
changing the implementation of the identified bottlenecks may give order of
magnitudes of speed improvement.
For instance, multi-threading abilities can be achieved by following
some simple rules.
With our huge set of regression tests, we have at hand more than 16,500,000 individual checks, covering low-level features (like numerical and text marshaling), or high-level process (like concurrent client/server and database multi-threaded process).
You will find here some benchmarks run with Delphi 6, 7, 2007, XE4 and XE6
under Win32, and XE4 and XE6 under Win64.
In short, all compilers performs more or less at the same speed.
Win64 is a
little slower than Win32, and the fastest appears to be Delphi 7, using our
enhanced and
optimized RTL.
2014-05-09
BREAKING CHANGE: TSQLRestServerStatic* classes are now renamed as TSQLRestStorage*
2014-05-09. Open Source › mORMot Framework

From the beginning, server-side storage tables which were not store in
a SQLite3 database were implemented via some classes
inheriting from TSQLRestServerStatic.
, which did not make much sense (but was
made for laziness years ago, if I remember well).
This TSQLRestServerStatic
was inheriting
from TSQLRestServer
Now, a new TSQLRestStorage
class, directly inheriting from
TSQLRest
, is used for per-table storage.
This huge code
refactoring results in a much cleaner design, and will enhance code
maintainability.
Documentation has been updated to reflect the changes.
Note that this won't change anything when using the framework (but the new class names): it is an implementation detail, which had to be fixed.
2014-05-07
MongoDB + mORMot benchmark
2014-05-07. Open Source › mORMot Framework
Here are some benchmark charts about MongoDB integration in mORMot's ORM.
MongoDB appears as a serious competitor to SQL databases, with the potential benefit of horizontal scaling and installation/administration ease - performance is very high, and its document-based storage fits perfectly with mORMot's advanced ORM features like Shared nothing architecture (or sharding).
MongoDB + mORMot ORM = ODM
2014-05-07. Open Source › mORMot Framework
MongoDB (from "humongous") is
a cross-platform document-oriented database system, and certainly the best
known NoSQL database.
According to http://db-engines.com in April
2014, MongoDB is in 5th place of the most popular types of database
management systems, and first place for NoSQL database management
systems.
Our mORMot gives premium access to this database, featuring full
NoSQL and Object-Document Mapping (ODM) abilities to the
framework.
Integration is made at two levels:
- Direct low-level access to the MongoDB server, in the
SynMongoDB.pas
unit; - Close integration with our ORM (which becomes defacto an ODM), in
the
mORMotMongoDB.pas
unit.
MongoDB eschews the traditional table-based relational database structure in favor of JSON-like documents with dynamic schemas (MongoDB calls the format BSON), which matches perfectly mORMot's RESTful approach.
This second article will focus on integration of MongoDB with our ORM.
Direct MongoDB database access
2014-05-07. Open Source › mORMot Framework
MongoDB (from "humongous") is
a cross-platform document-oriented database system, and certainly the best
known NoSQL database.
According to http://db-engines.com in April
2014, MongoDB is in 5th place of the most popular types of database
management systems, and first place for NoSQL database management
systems.
Our mORMot framework gives premium access to this database,
featuring full NoSQL and Object-Document Mapping (ODM) abilities to
the framework.
Integration is made at two levels:
- Direct low-level access to the MongoDB server, in the
SynMongoDB.pas
unit; - Close integration with our ORM (which becomes defacto an ODM), in
the
mORMotMongoDB.pas
unit.
MongoDB eschews the traditional table-based relational database structure in favor of JSON-like documents with dynamic schemas (MongoDB calls the format BSON), which matches perfectly mORMot's RESTful approach.
In this first article, we will detail direct low-level access to the
MongoDB server, via the SynMongoDB.pas
unit.
2014-04-28
Mustache Logic-less templates for Delphi - part 3
2014-04-28. Open Source › Open Source libraries
Mustache is
a well-known logic-less template engine.
There is plenty of Open Source implementations around (including in JavaScript,
which can be very convenient for AJAX applications on client side, for
instance).
For mORMot, we created the first pure Delphi implementation of it,
with a perfect integration with other bricks of the framework.
In last part of this series of blog articles, we will introduce the
Mustache library included within mORMot source code
tree.
You can download this documentation
as one single pdf file.
« previous entries - page 2 of 4 - next entries »