We have a few BPMs that assign customer IDs, ship to numbers, one-off part numbers, etc. by getting the current value from the appropriate row of
UD01, incrementing it, writing it back, and calling
Db.Validate(). One of these was written in 2010 by someone with an epicor.com email address, and I think the others were copied from that. Incrementing a counter this way is not atomic, and we’ve run into situations in production where two order lines were assigned the same one-off part number. Is there a preferred way to make this atomic?
Here’s my own crazy idea. Apparently there is no general way to perform an atomic increment through an EF
DbContext. But if all BPMs execute in the same
AppDomain, we could make a section atomic by synchronizing on a static variable. If nothing else, we could sync on a
Type. Can anyone think of a reason this won’t work?