You are not logged in.
Pages: 1
I have 2 classes A and B which inherit from a base class C.
A has a collection of B references
B has a reference to A.
These are implemented in my PODO objects as a TCollection (using generics) of B's and as a reference to A (+ some mechanisms to manage auto-updates of the inverse relationships when needed).
When I used the ComputeSQLRecord operation, it got it completely wrong: it implemented the reference to A in B as taking all the direct attributes of A (not the inherited ones from C) and putting them directly in B. Naturally the inherited attributes from C will be different in objects A and B.
Why would it not create an object relationship? Should it be done by hand?
Best regards,
Thierry
Thank you!
Indeed it is much simpler than I thought. The only object to create is the TSQLERestServerFullMemory. The TSQLRestStorageInMemory are not needed, as every operation can directly be performed on the RestServer.
initialization
Database := TSQLRestServerFullMemory.Create( Model, ChangeFileExt(Application.ExeName,'.json') );
finalization
FreeAndNil(model);
Database.ExportServer;
FreeAndNil(Database);
end.
and in the application layer:
objectA:= TSQLRecordA.CreateAndFillPrepare(Database, '');
...
Database.Add(objectA, true);
So? It seems to me Lazarus + FPC is quite capable of generating Windows code...
There is an i18n implementation on Lazarus.
I would suggest that compiler-specific (aka Delphi) code should be separated from the main mORMot sources. For the moment, it's not possible to distinguish easily what is cross-platform and usable anywhere to what is specific to a given platform and compiler.
BR
Many thanks.
No, I don't think TBufDataset should know about mORMot's TSQLRest, particularly in the InMemory version. I'll try to set up a clear test case.
BR
Hello,
i'm sorry to ask all these questions, but i'm trying to get into mORMot.
So is there a TDataset descendent to connect to TSQLRestStorageInMemory? ( a full one, not a read only version).
I would like to connect the TSQLRecord objects to the Lazarus GUI with TDataset.
Best regards,
Thierry
OK, i tried with TSQLRestServerFullMemory, using the following code in initialisation and finalisation:
Without the filename in the tableclient for class A, the database is not saved,
With the filename in the table client for class A, it is stored in its particular file, not the general file for the whole database.
What am I missing?
initialization
Database := TSQLRestServerFullMemory.Create( Model, ChangeFileExt(Application.ExeName,'.json') );
gTableA := TSQLRestStorageInMemory.Create( TSQLA, Database, ChangeFileExt(Application.ExeName,'.A.json'));
gTableB := TSQLRestStorageInMemory.Create( TSQLB, Database, ChangeFileExt(Application.ExeName,'.B.json'));
finalization
FreeAndNil(model);
FreeAndNil(gTableA);
FreeAndNil(gTableB);
Database.ExportServer;
FreeAndNil(Database);
end.
if one DOES NOT have Delphi.
Sorry, i'm using exclusively Lazarus+FPC. Ditched Delphi years ago and don't have any of it anymore.
So, is there any other way to generate the interfaces?
I saw the interfaces RTTI patch was nearing completion, but it's still not there...
I saw RTFM 25.4.2, but there's no example of the generated code, so i don't know what to write.
Would it be possible to post a couple of examples with the typical generated code?
Thanks.
Best regards,
Thierry
Thank you very much. I will try that.
I would suggest ComputeSQLRecord does not duplicate the code for the ancestor classes, if they are common.
Best regards,
Thierry
Hi
for the moment, this is valid only under windows, i used the TMetafile defined in EPANET2Lazarus, maded by lfrodrigues.
Obviously, i haven't been able to test, since the compiler had errors further down.
Best regards
Thierry
Line 893 does not compile:
"if ResStringRec.Identifier<64*1024 then begin"
with message "mORMoti18n.pas(893,19) Error: Illegal qualifier"
There are many others like this one.
Is there a compiler option i should set?
Environment: Lazarus + FPC 2.7.1
Creating a complete model:
SomeModel = TSQModel.Create([Set of SQL classes]) //Not domain classes, SQL classes.
Creating the client database (as in client/server):
Client := TSQLRestClientDB.Create(ClientModel, ServerModel, ChangeFileExt(Application.ExeName,'.db3'), TSQLRestServerDB);
Populating the tables (if missing or needed to update):
TSQLRestClientDB(globalClient).Server.CreateMissingTables(0);
This works in Lazarus + FPC 2.7.1
Hello,
is there a Lazarus port of the MainDemo?
It does not compile under FPC: most of the graphical units in mORMot don't compile.
I found a replacement for TMetafile but then the compiler raised an error just a few steps further.
Hello,
Imagine there are several classes in a domain:
A <- B <-C
<- D
<- E
Where D has a reference to C and E has a reference to D.
For example, how can one create a simple in-memory database? There are several issues i don't understand:
- TDDDRepositoryRestFactory.ComputeSQLRecord([C, D, E]) creates several duplicates (on all common ancestors). OK, i can remove the duplicates, but i would expect the operation to be able to identify the common ancestors.
- then TSQLRestStorageInMemory.Create takes only a single class as a parameter ???
How can the whole domain be persisted?
In a real application, there would be many domain classes, broken down in sub-domains.
FYI Environment : Lazarus/FPC 2.7.1. No Delphi environment.
Further information: The exception raised is in mormot.pas, class EORMException, TSQLPropInfoRTTI.CreateForm: Unhandled stfFloat/tkFloat type for property Number.
Does mORMot actually handle the extended type?
Hello,
How does mORMot handle the DDD upgrade? (adding new classes, attributes, associations, or removing same on an existing and in-use model?)
For example, in the basic 01-In Memory ORM demo,
- I compiled the basic demo, ran it a few times, added a few examples and quit, This worked perfectly, data is stored and retrieved. Nice.
- I then added one Number field with the TSynExtended type to the TSQLSampleRecord in the unit SampleData. Compiled. OK.
- I ran the resulting application. And it crashed with an External Sigsegv.
I'm using a form of Agile, and i would expect upwards-compatible modifications to the DDD to be accepted by the ORM. How can i do that?
I do have the capability to track and identify the model changes, if specific actions need to be perform to update the repository.
I'm using Lazarus with FPC 2.7.1.
Thank you for your help.
Best regards,
Thierry
Pages: 1