mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-08-06 09:26:52 +01:00
Add a new `events` knowledge domain covering AL events & subscribers, wired into the AL review pipeline. - 3 atomic articles (+ .good.al/.bad.al samples) under microsoft/knowledge/events/: the IsHandled override pattern, thin OnBefore/OnAfter integration-event publishers, and static vs manual subscribers. - New leaf skill microsoft/skills/review/al-events-review.md sourcing the events domain. - Wired into microsoft/skills/review/al-code-review.md (sub-skills + Source + description) and README.md (leaf-skill count + domain list). AL event syntax verified against Microsoft Learn. Samples are demonstration-only (not compiled by CI). Additive change; no contract change. Part of #34. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
36 lines
1.2 KiB
AL
36 lines
1.2 KiB
AL
// Demonstration-only AL. Not compiled by CI; illustrates the article.
|
|
table 50226 "Reservation Entry Bad Sample"
|
|
{
|
|
fields
|
|
{
|
|
field(1; "Entry No."; Integer) { }
|
|
field(2; "Item No."; Code[20]) { }
|
|
field(3; Quantity; Decimal) { }
|
|
field(4; Reserved; Boolean) { }
|
|
}
|
|
keys
|
|
{
|
|
key(PK; "Entry No.") { Clustered = true; }
|
|
}
|
|
}
|
|
|
|
codeunit 50227 "Reservation Post Bad Sample"
|
|
{
|
|
procedure Reserve(var ReservationEntry: Record "Reservation Entry Bad Sample")
|
|
begin
|
|
// Anti-pattern: the operation exposes no OnBefore/OnAfter seam, and the
|
|
// logic that should be the routine's own work lives in the event body
|
|
// below instead. Partners must overwrite this routine to change it.
|
|
OnReserve(ReservationEntry);
|
|
end;
|
|
|
|
// Anti-pattern: business logic inside an integration-event publisher. A
|
|
// publisher must be a thin, empty hook; logic placed here runs on every
|
|
// raise and cannot be overridden, which defeats the event entirely.
|
|
[IntegrationEvent(false, false)]
|
|
local procedure OnReserve(var ReservationEntry: Record "Reservation Entry Bad Sample")
|
|
begin
|
|
ReservationEntry.Reserved := true;
|
|
ReservationEntry.Modify(true);
|
|
end;
|
|
}
|