#1 2015-10-02 13:23:36

willo
Member
From: Cape Town, South Africa
Registered: 2014-11-15
Posts: 67
Website

contnrs not supported for native mobile

Hi Ab,

Playing with Delphi 10 Seattle, I wanted to bring in mORMot, but quickly realised that there's a big issue. System.Contnrs is not supported in mobile projects! That means no TObjectList. 
See mobile white paper:

"Use the generic container classes defined in the unit Generics.Collections. The old-style Contnrs unit is not available on the mobile platform, because it is based on a pointer list (the non-generic TList class) and won’t work properly with the ARC memory management model."

Does that mean no mORMot for mobile projects, or is there a clever work around?

Offline

#2 2015-10-02 13:48:12

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: contnrs not supported for native mobile

Mobile clients use cross-platform dedicated units.

See http://synopse.info/files/html/Synopse% … ml#TITL_86

For compatibility, the following type is defined:

  {$ifdef NEXTGEN}
  // TObjectList is not defined in Mobile platforms
  TObjectList = TObjectList<TObject>;
  {$endif}
 

Offline

#3 2015-10-02 13:57:06

willo
Member
From: Cape Town, South Africa
Registered: 2014-11-15
Posts: 67
Website

Re: contnrs not supported for native mobile

Brilliant! Thanks Ab!

Offline

#4 2015-10-02 14:30:20

willo
Member
From: Cape Town, South Africa
Registered: 2014-11-15
Posts: 67
Website

Re: contnrs not supported for native mobile

I can't seem to find anything relating to Interface based services (specifically TSQLHttpClient or other class that implements ServiceDefine) in any of the cross-platform dedicated units. Is this a Work In Progress?

Offline

#5 2015-10-02 14:49:29

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: contnrs not supported for native mobile

Interface-based services are supported in cross-platform clients.

See e.g. how TServiceCalculator is generated in https://github.com/synopse/mORMot/blob/ … Client.pas to implement a ICalculator service.

Please RTFM in my previous link.
For instance http://synopse.info/files/html/Synopse% … #TITLE_452
All is explained here.

Offline

#6 2015-10-03 13:35:10

willo
Member
From: Cape Town, South Africa
Registered: 2014-11-15
Posts: 67
Website

Re: contnrs not supported for native mobile

Oh! I didn't realise that this applies to FMX clients. Thanks Ab!

Offline

#7 2015-10-15 12:59:34

willo
Member
From: Cape Town, South Africa
Registered: 2014-11-15
Posts: 67
Website

Re: contnrs not supported for native mobile

Ab,

I had some time to play with it now, and it seems that the wrappers are not generating for my DTOs. I can't use the DTO unit, as my DTO's descend from SynCommons' TSynPersistent, and make heavy use of UTF8Raw.
Do I need to register my DTOs somewhere?

Offline

#8 2015-10-15 13:44:13

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: contnrs not supported for native mobile

So there is no code generated for you DTOs in mORMotClient.pas?

Offline

#9 2015-10-16 06:16:13

willo
Member
From: Cape Town, South Africa
Registered: 2014-11-15
Posts: 67
Website

Re: contnrs not supported for native mobile

No. I'll try and put together a small test application to illustrate the behavior.

Offline

#10 2015-10-16 12:07:23

willo
Member
From: Cape Town, South Africa
Registered: 2014-11-15
Posts: 67
Website

Re: contnrs not supported for native mobile

Hi Ab,

An example that illustrate the issue is here: https://goo.gl/YEGyj7

Offline

Board footer

Powered by FluxBB