How can I tell if updates were applied by server or client

I may have mentioned this before but it’d have been years ago and I can’t remember and it’s now come back to haunt me.

Basically I’m applying updates to a table which sends a delta to the server for processing. I’m using strongly-typed classes and a TDABusinessProcessorRules derived class to perform processing of the delta on the server.

Inside the functions of this class, specifically BeforeProcessDelta, I need to do some processing which depends on whether the original TDAMemDataTable.ApplyUpdates call was made by the client or the server itself.

Basically I have certain tables which are only permitted to be modified by the server itself. The client may use them to retrieve data but not modify. If the client wishes to modify them then it makes a separate service function call to the server which, in turn makes the changes to the tables. Thus the server must be able to modify the tables but not the client.

To achieve this, I need to know, inside the business processor logic, whether the original ApplyUpdates was client or server side. Is there any way I can do this?

I think, you can put a value into session that will inform what side was used - client side or server-side. in the BeforeProcessDelta event you can check this value.

I actually tried this and it does work, the issue is concurrency. If I get my service function to set a value in the session before applying the updates, then clear it again afterward, so the business processor functions can test for it, there’s a chance that multiple threads and service instances could clash and this code could overlap.

The only other thought I had was whether I can somehow add a custom value or tag to the delta itself?

if server-side performs updates via LDA, LDA can have own session which can have required value.

Yes, you can add custom field into delta.

1 Like

Ah ok thanks I think I can sort it that way.