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
}| Method | Description |
|---|---|
| Activate | Stores the train input (and optional extra objects) into Memory |
| Chain | Executes a junction, wiring its input from Memory and storing its output back |
| ShortCircuit | Executes a junction that can return early, bypassing remaining junctions |
| Extract | Pulls a nested property/field out of a Memory object into its own Memory slot |
| AddServices | Stores DI services into Memory so junctions can access them |
| Resolve | Extracts the final TReturn result from Memory (last call in RunInternal) |
| Run / RunEither | Executes the train from the outside — Run throws on failure, RunEither returns Either |