ARC0005: Value produced by Provide is not consumed by Handle
When a command declares a Provide() method, every value it produces must be consumed by a parameter of the command’s Handle() method. A produced value that no Handle parameter can receive is almost always a mistake.
Control values that short-circuit execution rather than feed Handle — ValidationResult, AuthorizationResult, and CommandResult — are exempt.
Severity
Section titled “Severity”Warning
Example
Section titled “Example”Violation
Section titled “Violation”using Cratis.Arc.Commands.ModelBound;
[Command]public record ApproveLoan(ApplicantId Applicant){ public CreditScore Provide(ICreditBureau bureau) => bureau.GetScore(Applicant);
public void Handle() { }}Provide returns a CreditScore, but Handle has no parameter that can receive it.
using Cratis.Arc.Commands.ModelBound;
[Command]public record ApproveLoan(ApplicantId Applicant){ public CreditScore Provide(ICreditBureau bureau) => bureau.GetScore(Applicant);
public LoanApproved Handle(CreditScore creditScore) => new(Applicant, creditScore);}See Provide data to a command handler for the full pattern.