Class OutcomeGenerator<TResult>
Generator that produces outcomes such as exceptions or results.
public sealed class OutcomeGenerator<TResult>
  Type Parameters
TResultThe type of the result.
- Inheritance
 - 
      
      OutcomeGenerator<TResult>
 
- Inherited Members
 
Remarks
An instance of this class is assignable to OutcomeGenerator.
Constructors
OutcomeGenerator()
Initializes a new instance of the OutcomeGenerator<TResult> class.
public OutcomeGenerator()
  Methods
AddException(Func<ResilienceContext, Exception>, int)
Registers an exception generator delegate that accepts a ResilienceContext.
public OutcomeGenerator<TResult> AddException(Func<ResilienceContext, Exception> generator, int weight = 100)
  Parameters
generatorFunc<ResilienceContext, Exception>The delegate that generates the exception, accepting a ResilienceContext.
weightintThe weight assigned to this generator. Defaults to
100.
Returns
- OutcomeGenerator<TResult>
 The current instance of OutcomeGenerator<TResult>.
AddException(Func<Exception>, int)
Registers an exception generator delegate.
public OutcomeGenerator<TResult> AddException(Func<Exception> generator, int weight = 100)
  Parameters
generatorFunc<Exception>The delegate that generates the exception.
weightintThe weight assigned to this generator. Defaults to
100.
Returns
- OutcomeGenerator<TResult>
 The current instance of OutcomeGenerator<TResult>.
AddException<TException>(int)
Registers an exception generator for a specific exception type, using the default constructor of that exception.
public OutcomeGenerator<TResult> AddException<TException>(int weight = 100) where TException : Exception, new()
  Parameters
weightintThe weight assigned to this generator. Defaults to
100.
Returns
- OutcomeGenerator<TResult>
 The current instance of OutcomeGenerator<TResult>.
Type Parameters
TExceptionThe type of the exception to generate.
AddResult(Func<ResilienceContext, TResult>, int)
Registers a result generator.
public OutcomeGenerator<TResult> AddResult(Func<ResilienceContext, TResult> generator, int weight = 100)
  Parameters
generatorFunc<ResilienceContext, TResult>The delegate that generates the result, accepting a ResilienceContext.
weightintThe weight assigned to this generator. Defaults to
100.
Returns
- OutcomeGenerator<TResult>
 The current instance of OutcomeGenerator<TResult>.
AddResult(Func<TResult>, int)
Registers a result generator.
public OutcomeGenerator<TResult> AddResult(Func<TResult> generator, int weight = 100)
  Parameters
generatorFunc<TResult>The delegate that generates the result.
weightintThe weight assigned to this generator. Defaults to
100.
Returns
- OutcomeGenerator<TResult>
 The current instance of OutcomeGenerator<TResult>.