You are not logged in.
Pages: 1
Hi ab,
what is the best way to use trigger in mORMot?
i need to update other TSQLRecord on insert/update/delete...
I see OnUpdateEvent, but how can be sure that all trigger operations are atomic with the insert/update/delete that raise?
thanks
Offline
Excuse me ab but i think i must put this at server-side level. I can't expect that all client appplication know business logic.
I think OnUpdateEvent should be perfect if i can do atomic operation like in a transaction.
Have you different idea about this?what do you suggest?
Offline
Indeed.
All the business logic should be done on the server side.
You should not have to use the ORM on the client side, if there is some business logic.
I mean "business logic", when you write some information.
For read-only process, we "may" directly access the data via REST/ORM, if it sounds safe enough.
But the best pattern is to define high-level SOA services on the server side, which would use the ORM on the server side, over several tables if needed.
Offline
thinking about your suggest i write an interface-based-service to save and delete my TSQLRecord class.
something like this
IServiceCRUD = interface(IInvokable)['{FDD9121B-77A4-4C20-A283-42A80D54D42F}']
function Delete(aRecord: TSQLRecord; var IDs: TIDDynArray): Integer;
function Save(aRecord: TSQLRecord): Integer;
end;
and in implementation class (server-side) i write my business logic.
but i see that TSQLRecord is a bad parameter.
How can i do?
thanks for the patience
Offline
i can define a method based services instead to declare an ancestor class?it works?
i would a service that passing a generic TSQLRecord can store it to the server in atomic operation with business logic if exists.
Offline
It would work only for a given TSQLRecord class.
The service would always benefit to be specified per-class.
Do not even use TSQLRecord, but value objects, ready to be consumed on client side.
With mORMot SOA, it is easy to write such services.
Offline
Pages: 1