@@ -109,9 +109,15 @@ public IStepBuilder<TData, TStepBody> Output<TOutput>(Expression<Func<TData, TOu
109
109
return this ;
110
110
}
111
111
112
- public IStepBuilder < TData , WaitFor > WaitFor ( string eventName , Expression < Func < TData , string > > eventKey , Expression < Func < TData , DateTime > > effectiveDate = null )
112
+ public IStepBuilder < TData , WaitFor > WaitFor ( string eventName , Expression < Func < TData , string > > eventKey , Expression < Func < TData , DateTime > > effectiveDate = null , Expression < Func < TData , bool > > cancelCondition = null )
113
113
{
114
- var newStep = new WorkflowStep < WaitFor > ( ) ;
114
+ WorkflowStep < WaitFor > newStep ;
115
+
116
+ if ( cancelCondition != null )
117
+ newStep = new CancellableStep < WaitFor , TData > ( cancelCondition ) ;
118
+ else
119
+ newStep = new WorkflowStep < WaitFor > ( ) ;
120
+
115
121
WorkflowBuilder . AddStep ( newStep ) ;
116
122
var stepBuilder = new StepBuilder < TData , WaitFor > ( WorkflowBuilder , newStep ) ;
117
123
stepBuilder . Input ( ( step ) => step . EventName , ( data ) => eventName ) ;
@@ -126,9 +132,15 @@ public IStepBuilder<TData, WaitFor> WaitFor(string eventName, Expression<Func<TD
126
132
return stepBuilder ;
127
133
}
128
134
129
- public IStepBuilder < TData , WaitFor > WaitFor ( string eventName , Expression < Func < TData , IStepExecutionContext , string > > eventKey , Expression < Func < TData , DateTime > > effectiveDate = null )
135
+ public IStepBuilder < TData , WaitFor > WaitFor ( string eventName , Expression < Func < TData , IStepExecutionContext , string > > eventKey , Expression < Func < TData , DateTime > > effectiveDate = null , Expression < Func < TData , bool > > cancelCondition = null )
130
136
{
131
- var newStep = new WorkflowStep < WaitFor > ( ) ;
137
+ WorkflowStep < WaitFor > newStep ;
138
+
139
+ if ( cancelCondition != null )
140
+ newStep = new CancellableStep < WaitFor , TData > ( cancelCondition ) ;
141
+ else
142
+ newStep = new WorkflowStep < WaitFor > ( ) ;
143
+
132
144
WorkflowBuilder . AddStep ( newStep ) ;
133
145
var stepBuilder = new StepBuilder < TData , WaitFor > ( WorkflowBuilder , newStep ) ;
134
146
stepBuilder . Input ( ( step ) => step . EventName , ( data ) => eventName ) ;
@@ -142,7 +154,7 @@ public IStepBuilder<TData, WaitFor> WaitFor(string eventName, Expression<Func<TD
142
154
Step . Outcomes . Add ( new StepOutcome ( ) { NextStep = newStep . Id } ) ;
143
155
return stepBuilder ;
144
156
}
145
-
157
+
146
158
public IStepBuilder < TData , TStep > End < TStep > ( string name ) where TStep : IStepBody
147
159
{
148
160
var ancestor = IterateParents ( Step . Id , name ) ;
0 commit comments