Release v20.42.0
Summary
Commands can now declare a Provide() method that runs before Handle(). It fetches or computes the data the decision needs and passes it into Handle() as arguments, so Handle() stays a pure, easily tested function of its inputs. It can also short-circuit the command before Handle() runs.
Added
- Commands can define a
Provide()method that suppliesHandle()'s arguments — fetched or computed, with its own parameters resolved from dependency injection — without registering those values in the container. Single, tuple,Result<,>, and async (Task/ValueTask) return shapes are all supported. - New analyzer rule ARC0005 warns when a value produced by
Provide()is not consumed by anyHandle()parameter.