public static bool FoxRecordLock(this AdsExtendedReader rdr, string table) { var isLocked = false; for (var i = 0; i < 100; i++) { try { rdr.LockRecord(); isLocked = rdr.IsRecordLocked(); if (isLocked) { break; } } catch (Exception e) { Debug.WriteLine($"waiting for lock {rdr.RecordNumber}"); System.Threading.Thread.Sleep(500); } } if (!isLocked) { Debug.WriteLine($"Unable to flock {table}"); } return(isLocked); }