#1 Re: mORMot 1 » Some basic questions » 2020-07-17 02:00:16

Dear Administrator,

a pessimistic lock as suggested by Bernd is one option. I can understand that you do not want to implement that feature for a stateless server.

But what about optimistic locking? I am studying mORMot to decide if my next project will be done with mORMot instead of DataSnap and TClientDataSets. So far I have had a version number on each record that was incremented by the application server. The primary key value and the version number of the record was good enough to identify if the record changed since the client-side fetched the record. Obviously the server had to increment the version number and that change on the record was transported back into the client without a single line of code. Just by including the poPropogateChanges into the TDataSetProvider.Options any server-side change was transported back into the client.

I thought that TModTime would be something similar as I looked at the mORMot documentation. But in the sample project 03 NamedPipe the value is assigned on the client-side. Even if there is a chance to get this done on the server-side I would still need other properties to be updated on the server-side before they are saved in the database and that change would have to go back into the client-side without too much effort. What is the best way to achieve that with mORMot?

A sample on how TMS Aurelius handles such situations can be found here.

Salut,
  Mathias

Board footer

Powered by FluxBB