#1 2015-09-26 08:31:43

michaschumann
Member
Registered: 2015-09-26
Posts: 2

DocVariant Questions

Hello,

First of all I need to say that this framework is awesome! I am really pissed off not having discovered it much earlier! It would have affected both developments speed and quality of my software a lot! Thanks for that huge work and for making it available!

I have some questions about the amazing TDocVariant type:

1. Would it be possible to extend the framework with an option do allow access to members not yet known?
Example: I want to use it to store my application settings (permanently growing) in a TDocVariant object because I just would have to use a setting to make it available and can store/save easily to the database or to the registry. Unfortunately new settings are first read and later stored. So I have to initialize every setting first to make it available which in this case partly distroys the big advantage of not having to define it in the first place. Would it be possible to define some kind of "Null" value that is returned instead or raising an exception whenever a nonexistend member is accessed?

2. Is it Possible to use TDocVariant instead of SQLRecord and store its members in a sql table and only "sub"-Members as JSON?

Thanks in advance!

Michael

Offline

#2 2015-09-26 08:38:23

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

Re: DocVariant Questions

Thanks for the kind words.

1. You can create the TDocVariant with the dvoReturnNullForUnknownProperty option.
For settings, check https://github.com/synopse/mORMot/blob/ … ttings.pas which has a lot of built-in features for storing settings (e.g. REST instance creation at runtime, or logging settings, remote real-time monitoring, storage as JSON...).
In was not officially announced in the main Documentation, because it is part of a new main chapter, about writing DDD services, in a cloud of mORMot servers. But the unit documentation is available.

2. How would you define the table structure?
The TSQLRecord class definition is used to define the table structure.

Online

#3 2015-09-26 16:27:42

michaschumann
Member
Registered: 2015-09-26
Posts: 2

Re: DocVariant Questions

Great. This helps a lot.

Offline

Board footer

Powered by FluxBB