RunInline(Func<TResult>)
static
public static TResult RunInline<TResult>(Func<TResult> effect) Runs
effect in the caller's current work item before returning, and records its outcome, which every later run of the task's body returns without running effect again. Parameters
effectFunc<TResult>- The synchronous effect, which returns every value the body uses.
Returns
The result which the effect returned when it ran.
Exceptions
System.ArgumentNullExceptioneffectisnull.System.InvalidOperationException- The host can't record the effect from the calling code, for example after
ConfigureAwait(false). Orleans.Durable.Tasks.DurableTaskAttemptCanceledException- The host canceled the attempt, for example with
DurableTaskAttemptCancellationReasonbecause an earlier run recorded another kind of operation, such as a step, under the effect's generated identifier. System.NotSupportedExceptionTResultis an asynchronous operation, such as aSystem.Threading.Tasks.Task, aSystem.Threading.Tasks.ValueTask, or aDurableTask, or the host doesn't support recorded effects.
Examples
var paymentId = DurableTask.RunInline(Guid.NewGuid);