Each included {@link ICommand} will be
/// executed in turn, until either one of them returns true
,
/// one of the executed {@link ICommand}s throws an Exception,
/// or the end of the chain has been reached. The {@link IChain} itself will
/// return the return value of the last {@link ICommand} that was executed
/// (if no exception was thrown), or rethrow the thrown Exception.
Note that {@link IChain} extends {@link ICommand}, so that the two can /// be used interchangeably when a {@link ICommand} is expected. This makes it /// easy to assemble workflows in a hierarchical manner by combining subchains /// into an overall processing chain.
/// ///To protect applications from evolution of this interface, specialized /// implementations of {@link IChain} should generally be created by extending /// the provided base class {@link Agility.Core.Chain}) /// rather than directly implementing this interface.
/// ///{@link IChain} implementations should be designed in a thread-safe
/// manner, suitable for execution on multiple threads simultaneously. In
/// general, this implies that the state information identifying which
/// {@link ICommand} is currently being executed should be maintained in a
/// local variable inside the Execute
method, rather than
/// in an instance variable. The {@link ICommand}s in a {@link IChain} may be
/// configured (via calls to AddCommand
) at any time before
/// the Execute()
method of the {@link IChain} is first called.
/// After that, the configuration of the {@link IChain} is frozen.
Execute()
/// method is called.
///Once Execute
has been called
/// at least once, it is no longer possible to add additional
/// {@link ICommand}s; instead, an Exception will be thrown.
Processing uses the following algorithm:
///false
.Execute
method of each {@link ICommand}
/// configured on this chain, in the order they were added via calls
/// to the AddCommand
method, until the end of the
/// configured {@link ICommand}s is encountered, or until one of
/// the executed {@link ICommand}s returns true
/// or throws an Exception.Execute
methods, starting with the last one that
/// was executed. If this {@link ICommand} instance is also a
/// {@link IFilter}, call its PostProcess
method.
/// If PostProcess
throws an Exception, it is ignored.Execute
method
/// was called throws an Exception, rethrow that Exception.Execute
/// method of the last {@link ICommand} that was executed. This will be
/// true
if the last {@link ICommand} indicated that
/// processing of this {@link IContext} has been completed, or
/// false
if none of the called {@link ICommand}s
/// returned true
.true
if the processing of this {@link IContext}
/// is complete, or false
if further processing
/// of this {@link IContext} can be delegated to a subsequent
/// {@link ICommand} in an enclosing {@link IChain}