mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-10-07 23:56:56 +01:00
Promote knowledge for Microsoft review skills (#153)
Move canonical knowledge for Microsoft-owned review domains into the Microsoft layer and document the skill/knowledge co-location policy. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com> Copilot-Session: 2a6ea875-d38e-4f30-aadb-0d606f9be231
This commit is contained in:
parent
bca8f478d8
commit
4f0a13a801
88 changed files with 11 additions and 7 deletions
|
|
@ -1,59 +0,0 @@
|
|||
// Demonstration only. Shows the correct pattern: a public facade codeunit whose event publishers
|
||||
// are internal, so only the implementation codeunit decides when they fire.
|
||||
|
||||
codeunit 50100 "Loyalty Points Mgt Good"
|
||||
{
|
||||
procedure AwardPoints(CustomerNo: Code[20]; SalesAmount: Decimal)
|
||||
var
|
||||
LoyaltyPointsImpl: Codeunit "Loyalty Points Impl Good";
|
||||
begin
|
||||
LoyaltyPointsImpl.AwardPoints(CustomerNo, SalesAmount);
|
||||
end;
|
||||
|
||||
// internal, not public: the implementation codeunit raises this and nobody else. Subscribers
|
||||
// bind through Codeunit::"Loyalty Points Mgt Good", which is public by default - that object
|
||||
// access is all a subscriber in another extension needs.
|
||||
[IntegrationEvent(false, false)]
|
||||
internal procedure OnBeforeAwardPoints(CustomerNo: Code[20]; var Points: Decimal; var IsHandled: Boolean)
|
||||
begin
|
||||
end;
|
||||
|
||||
[IntegrationEvent(false, false)]
|
||||
internal procedure OnAfterAwardPoints(CustomerNo: Code[20]; Points: Decimal)
|
||||
begin
|
||||
end;
|
||||
}
|
||||
|
||||
codeunit 50101 "Loyalty Points Impl Good"
|
||||
{
|
||||
Access = Internal;
|
||||
|
||||
procedure AwardPoints(CustomerNo: Code[20]; SalesAmount: Decimal)
|
||||
var
|
||||
LoyaltyPointsMgt: Codeunit "Loyalty Points Mgt Good";
|
||||
Points: Decimal;
|
||||
IsHandled: Boolean;
|
||||
begin
|
||||
Points := SalesAmount / 10;
|
||||
|
||||
IsHandled := false;
|
||||
LoyaltyPointsMgt.OnBeforeAwardPoints(CustomerNo, Points, IsHandled);
|
||||
if IsHandled then
|
||||
exit;
|
||||
|
||||
// ... insert the loyalty entry ...
|
||||
|
||||
LoyaltyPointsMgt.OnAfterAwardPoints(CustomerNo, Points);
|
||||
end;
|
||||
}
|
||||
|
||||
codeunit 50102 "Loyalty Points Sub Good"
|
||||
{
|
||||
// The shape a subscriber in a dependent extension takes: it names the public object, and is
|
||||
// indifferent to the publisher being internal.
|
||||
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Loyalty Points Mgt Good", 'OnAfterAwardPoints', '', false, false)]
|
||||
local procedure LogAwardedPointsOnAfterAwardPoints(CustomerNo: Code[20]; Points: Decimal)
|
||||
begin
|
||||
// ... write telemetry ...
|
||||
end;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue