Train Methods

Methods available on Train<TInput, TReturn> for composing junctions inside RunInternal. These are the core building blocks of every Trax.Core train pipeline.

A typical train calls these methods in sequence:

protected override async Task<Either<Exception, OrderResult>> RunInternal(OrderInput input)
{
    return Activate(input)              // Store input in Memory
        .Chain<ValidateOrder>()         // Execute junction, auto-wiring input/output via Memory
        .Chain<ProcessPayment>()
        .Chain<SendConfirmation>()
        .Resolve();                     // Extract the final result from Memory
}
MethodDescription
ActivateStores the train input (and optional extra objects) into Memory
ChainExecutes a junction, wiring its input from Memory and storing its output back
ShortCircuitExecutes a junction that can return early, bypassing remaining junctions
ExtractPulls a nested property/field out of a Memory object into its own Memory slot
AddServicesStores DI services into Memory so junctions can access them
ResolveExtracts the final TReturn result from Memory (last call in RunInternal)
Run / RunEitherExecutes the train from the outside — Run throws on failure, RunEither returns Either