#1 2022-08-18 09:51:27

VojkoCendak
Member
From: Celje Slovenia
Registered: 2012-09-02
Posts: 88

Property gets updated even when there is readonly property

Hi,
Mormot 1 (latest), and D11 ent, win32

This was hidden ... and I don't know if this is normal.

We have object of TPersistent that is part of main object TPersistent:
TMainObj=clas(TPersistent)
...
published
  mySubObject:TMySubObject...
...
end;

We normally use json to store objects and retreive them.

property in question:
TMySubObject
published
  property PropAlwaysRestored: TDatetime read FPropAlwaysRestored;  // <== FPropAlwaysRestored gets updated !!!??

I checked the JSON file value of property. And after JSON2Object this value is restored in object.

Thank you,
Vojko Cendak

Offline

#2 2022-08-18 13:22:31

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

Re: Property gets updated even when there is readonly property

The RTTI part of mORMot is indeed using the "read" field to unserialize the property.

This is a feature, because it makes serialization working even if normal the property read-only from pascal code.
We did this since early version of mORMot 1 years ago. wink

Offline

#3 2022-08-19 10:00:28

VojkoCendak
Member
From: Celje Slovenia
Registered: 2012-09-02
Posts: 88

Re: Property gets updated even when there is readonly property

thank you,
Good to know

Offline

Board footer

Powered by FluxBB