Context
In #283 / PR #286, we added TableHelper.IsSetupTable() to suppress PC0030 on setup table parameterless Get() calls. The current heuristic checks:
- Single PK field
- PK field type is Code
- PK field name matches "Primary Key" or "PrimaryKey" (case-insensitive)
Enhancement
Add an additional check: detect tables that define a public GetRecordOnce() method (or similar caching pattern). This is Microsoft's preferred optimization for setup tables and could serve as a secondary signal for tables that don't follow the "Primary Key" field naming convention.
Microsoft's pattern
procedure GetRecordOnce()
begin
if RecordHasBeenRead then
exit;
Get();
RecordHasBeenRead := true;
end;
This pattern exists on 9+ major setup tables in the BaseApp (GeneralLedgerSetup, SalesReceivablesSetup, PurchasesPayablesSetup, InventorySetup, ManufacturingSetup, JobsSetup, MarketingSetup, ServiceMgtSetup, WarehouseSetup).
Implementation notes
- Could check
ITableTypeSymbol for a method named GetRecordOnce (or match a pattern like Get*Once)
- This would be an OR condition alongside the existing PK-based heuristic
- Consider if the method needs to be public or if internal/local patterns also count
Context
In #283 / PR #286, we added
TableHelper.IsSetupTable()to suppress PC0030 on setup table parameterlessGet()calls. The current heuristic checks:Enhancement
Add an additional check: detect tables that define a public
GetRecordOnce()method (or similar caching pattern). This is Microsoft's preferred optimization for setup tables and could serve as a secondary signal for tables that don't follow the "Primary Key" field naming convention.Microsoft's pattern
This pattern exists on 9+ major setup tables in the BaseApp (GeneralLedgerSetup, SalesReceivablesSetup, PurchasesPayablesSetup, InventorySetup, ManufacturingSetup, JobsSetup, MarketingSetup, ServiceMgtSetup, WarehouseSetup).
Implementation notes
ITableTypeSymbolfor a method namedGetRecordOnce(or match a pattern likeGet*Once)