LC0031 - StefanMaron/BusinessCentral.LinterCop GitHub Wiki
Use ReadIsolation instead of LockTable.
Best pratice is to replace LockTable()
with ReadIsolation(IsolationLevel::UpdLock)
.
This allows to control transaction isolation in a more granular way. More details about Record instance isolation level - Business Central | Microsoft Learn.
Record instance isolation level
Set the ReadIsolation on the record in stead of the LockTable method.
LockTable
LockTable adds the table to the list of locked tables in the global SessionState object, thus affecting all instances of this record within the session.
MyRecord.LockTable(); // You could read this as LockTable(Database::MyRecord)
ReadIsolation
ReadIsolation modifies the TableState object linked to the specific Record variable
MyRecord.ReadIsolation(IsolationLevel::UpdLock);