Can I depend on updates being applied in the order I made them?


(tobygroves) #1

I have a scenario where I may make multiple updates to a single table but the order in which they’re applied is critical. Basically I have a table where only a single record may have a boolean field set to True, so if this is to change, I must set the old record’s field to False before setting the new record’s to True or it’ll fail.

So, if I ensure that my code always makes these two updates in the correct order, can I rely on the server’s delta & change processing to apply them in that order?


(EvgenyK) #2

Hi,

you can use BusinessProcessor.OnBeforeProcessDelta and adjust delta as you want.


if you have update and new change - it can be solved via UpdateRules inside Schema Modeller


(tobygroves) #3

I’m not sure how the update rules help me - those are for determining the order inserts/updates/deletes are applied to different tables. In this scenario, it’s two updates on the same table.

I don’t really want to start delving into the delta, I was hoping that, if the two updates are added to the delta in the order I make them, that’s the order they’d be processed in and they wouldn’t ever be rearranged for any reason


(EvgenyK) #4

it can be applied to the same table too:

you can just check that order is correct in this event