Beispiel #1
0
 private EventsHandler(string tag, TInput stackInput, TState state, Emptyable <Tin> input, IStackEvents <TOperationEvent> stackEvents, Func <TEvent, bool> filter = null)
     : base(tag, stackInput, state, input, stackEvents)
 {
     Input             = input;
     events            = stackEvents.FilterErrors(null, filter);
     IsEmptyEventBlock = !events.Any();
 }
 public BlockResult <T> Complete(object overrideResult)
 {
     return(new BlockResult <T>
     {
         Target = new BlockResultTarget
         {
             FlowTarget = BlockFlowTarget.Complete,
             OverrideResult = Emptyable.Create(overrideResult)
         }
     });
 }
 public BlockResult <T> Retry(object overrideInput)
 {
     return(new BlockResult <T>
     {
         Target = new BlockResultTarget
         {
             FlowTarget = BlockFlowTarget.Retry,
             OverrideInput = Emptyable.Create(overrideInput)
         }
     });
 }
 public BlockResult <T> Goto(int index, object overrideInput)
 {
     return(new BlockResult <T>
     {
         Target = new BlockResultTarget
         {
             FlowTarget = BlockFlowTarget.Goto,
             TargetIndex = index,
             OverrideInput = Emptyable.Create(overrideInput)
         }
     });
 }
 public BlockResult <T> Goto(string tag, object overrideInput)
 {
     return(new BlockResult <T>
     {
         Target = new BlockResultTarget
         {
             FlowTarget = BlockFlowTarget.Goto,
             TargetTag = tag,
             OverrideInput = Emptyable.Create(overrideInput)
         }
     });
 }
 public BlockResult <T> Skip(int i, object overrideInput)
 {
     return(new BlockResult <T>
     {
         Target = new BlockResultTarget
         {
             FlowTarget = BlockFlowTarget.Skip,
             TargetIndex = i,
             OverrideInput = Emptyable.Create(overrideInput)
         }
     });
 }
Beispiel #7
0
 private ErrorsHandler(string tag, TInput stackInput, TState state, Emptyable <Tin> input, IStackEvents <TOperationEvent> stackEvents, Func <TError, bool> filter = null, bool?handled = null, bool handle = false)
     : base(tag, stackInput, state, input, stackEvents)
 {
     Input  = input;
     errors = stackEvents.FilterErrors(handled, filter);
     if (handle)
     {
         foreach (var e in errors)
         {
             e.Handle();
         }
     }
     IsEmptyEventBlock = !errors.Any();
 }
Beispiel #8
0
        public Emptyable <Tout> ConvertTo <Tout>()
        {
            Emptyable <Tout> e = new Emptyable <Tout>();

            if (!IsEmpty)
            {
                if (typeof(T) == typeof(Tout))
                {
                    e = new Emptyable <Tout>(((Tout)(object)value));
                }
                else if (typeof(T) != typeof(Tout))
                {
                    e = new Emptyable <Tout>((Tout)Convert.ChangeType(value, typeof(T)));
                }
            }

            return(e);
        }
Beispiel #9
0
 public IEmptyable ConvertTo(Type type)
 {
     if (!IsEmpty)
     {
         if (typeof(T) == type)
         {
             return(Emptyable.Create(value));
         }
         else
         {
             return(Emptyable.Create(Convert.ChangeType(value, type)));
         }
     }
     else
     {
         return(Emptyable.Create(type));
     }
 }
Beispiel #10
0
 public ErrorsHandler(string tag, TInput stackInput, TState state, Emptyable <Tin> input, IStackEvents <TOperationEvent> stackEvents, Action <IErrorsHandler <TError, TInput, TState, TOperationEvent, Tin> > action, Func <TError, bool> filter = null, bool?handled = null, bool handle = false)
     : this(tag, stackInput, state, input, stackEvents, filter, handled, handle)
 {
     executor = () => { action(this); return(Return(input.Value)); };
 }
Beispiel #11
0
 public ErrorsHandler(string tag, TInput stackInput, TState state, Emptyable <Tin> input, IStackEvents <TOperationEvent> stackEvents, Func <IErrorsHandler <TError, TInput, TState, TOperationEvent, Tin>, BlockResult <Tin> > func, Func <TError, bool> filter = null, bool?handled = null, bool handle = false)
     : this(tag, stackInput, state, input, stackEvents, filter, handled, handle)
 {
     executor = () => func(this);
 }
Beispiel #12
0
 internal BlockResult(Emptyable <T> result)
 {
     Result = result;
 }
Beispiel #13
0
 internal BlockResult()
 {
     Result = new Emptyable <T>();
 }
Beispiel #14
0
 public QueryResult(bool success, IEnumerable <BlockTraceResult <TOperationEvent> > stackTrace, TInput stackInput, TState stackState, Emptyable <T> result)
     : base(success, stackTrace, stackInput, stackState)
 {
     Result = result;
 }
Beispiel #15
0
 public EventsHandler(string tag, TInput stackInput, TState state, Emptyable <Tin> input, IStackEvents <TOperationEvent> stackEvents, Func <IEventsHandler <TEvent, TInput, TState, TOperationEvent, Tin>, BlockResult <Tin> > func, Func <TEvent, bool> filter = null)
     : this(tag, stackInput, state, input, stackEvents, filter)
 {
     executor = () => func(this);
 }