You are not logged in.
Pages: 1
Obviosly I can not do like this:
// Some declarations:
private
fModel: TOrmModel;
fDBServer: IRestOrmServer;
fProps: TSqlDBOleDBConnectionProperties;
The init code:
fModel := CreateLOBModel;
ConnectDB(LOBMonSetupRec.DBServer, LOBMonSetupRec.Database, LOBMonSetupRec.UserName, LOBMonSetupRec.PassWord);
VirtualTableExternalRegister(Model, TSQLLobUserControllv2, fProps, 'dbo.LobUserControllv2');
VirtualTableExternalRegister(Model, TSQLLob_GroupUsers, fProps, 'dbo.Lob_GroupUsers');
VirtualTableExternalRegister(Model, TSQLLobGroupDtl, fProps, 'dbo.LobGroupDtl');
rs := TRestServerDB.Create(Model);
fDBServer := TRestOrmServer.Create(rs); // Gives the exception: First chance exception at $77171E94. Exception class ERestException with message 'TRestServerDB.SetOrmInstance twice'.
// Never reach this part cause of the exception
DBServer.CreateMissingTables;I can not use the TRestServerDB instance when I creates the fDBServer as both calls SetOrmInstance so, what type should I use?
Delphi-11, WIN10 and Win11
Offline
No, this is clearly incorrect.
You don't call TRestOrmServer.Create by yourself.
You initialize TRestServerDB then you use the IRestOrm as interface, from TRestServerDB.Orm or IRestOrmServer from TRestServerDB.Server!
This is clearly documented as such.
I tried to make it even more explicit:
https://github.com/synopse/mORMot2/comm … 0957f36816
Offline
Ok, I think I understand so I did like this:
fDBServer := TRestServerDB.Create(Model).Server;And that made it!
Sorry but I have obviosly very hard to finds things in the doc. I always try to find things in the source and mostly I find it there but not too often.
Delphi-11, WIN10 and Win11
Offline
Pages: 1