Apply [JsonConstructor] to fix deserialization
This commit is contained in:
parent
a4011278cc
commit
17ff2d2c93
|
|
@ -1,4 +1,5 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using Elsa.Telnyx.Attributes;
|
||||
using Elsa.Telnyx.Bookmarks;
|
||||
using Elsa.Telnyx.Client.Models;
|
||||
|
|
@ -21,6 +22,7 @@ namespace Elsa.Telnyx.Activities;
|
|||
public class FlowAnswerCall : AnswerCallBase
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public FlowAnswerCall([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using Elsa.Telnyx.Attributes;
|
||||
using Elsa.Telnyx.Bookmarks;
|
||||
using Elsa.Telnyx.Client.Models;
|
||||
|
|
@ -20,6 +21,7 @@ namespace Elsa.Telnyx.Activities;
|
|||
public class FlowBridgeCalls : BridgeCallsBase
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public FlowBridgeCalls([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
@ -32,6 +34,7 @@ public class FlowBridgeCalls : BridgeCallsBase
|
|||
public class BridgeCalls : BridgeCallsBase
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public BridgeCalls([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using Elsa.Telnyx.Attributes;
|
||||
using Elsa.Telnyx.Bookmarks;
|
||||
using Elsa.Telnyx.Client.Models;
|
||||
|
|
@ -127,6 +128,7 @@ public abstract class DialBase : ActivityBase
|
|||
[FlowNode("Answered", "Hangup", "Voicemail")]
|
||||
public class FlowDial : DialBase
|
||||
{
|
||||
[JsonConstructor]
|
||||
private FlowDial([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
@ -147,6 +149,7 @@ public class FlowDial : DialBase
|
|||
public class Dial : DialBase
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public Dial([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using Elsa.Telnyx.Attributes;
|
||||
using Elsa.Telnyx.Bookmarks;
|
||||
using Elsa.Telnyx.Client.Models;
|
||||
|
|
@ -23,6 +24,7 @@ namespace Elsa.Telnyx.Activities;
|
|||
public class GatherUsingAudio : ActivityBase<CallGatherEndedPayload>, IBookmarksPersistedHandler
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public GatherUsingAudio([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using Elsa.Telnyx.Attributes;
|
||||
using Elsa.Telnyx.Bookmarks;
|
||||
using Elsa.Telnyx.Client.Models;
|
||||
|
|
@ -24,6 +25,7 @@ namespace Elsa.Telnyx.Activities;
|
|||
public class GatherUsingSpeak : ActivityBase<CallGatherEndedPayload>, IBookmarksPersistedHandler
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public GatherUsingSpeak([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using Elsa.Telnyx.Client.Models;
|
||||
using Elsa.Telnyx.Client.Services;
|
||||
using Elsa.Telnyx.Extensions;
|
||||
|
|
@ -16,6 +17,7 @@ namespace Elsa.Telnyx.Activities;
|
|||
public class FlowHangupCall : HangupCallBase
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public FlowHangupCall([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
@ -31,6 +33,7 @@ public class FlowHangupCall : HangupCallBase
|
|||
public class HangupCall : HangupCallBase
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public HangupCall([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using Elsa.Expressions.Models;
|
||||
using Elsa.Telnyx.Bookmarks;
|
||||
using Elsa.Telnyx.Extensions;
|
||||
|
|
@ -23,6 +24,7 @@ namespace Elsa.Telnyx.Activities;
|
|||
public class IncomingCall : Trigger<CallInitiatedPayload>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public IncomingCall([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using Elsa.Telnyx.Client.Models;
|
||||
using Elsa.Telnyx.Client.Services;
|
||||
using Elsa.Workflows.Core;
|
||||
|
|
@ -15,6 +16,7 @@ namespace Elsa.Telnyx.Activities;
|
|||
public class LookupNumber : Activity<NumberLookupResponse>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public LookupNumber([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using Elsa.Telnyx.Attributes;
|
||||
using Elsa.Telnyx.Bookmarks;
|
||||
using Elsa.Telnyx.Client.Models;
|
||||
|
|
@ -20,6 +21,7 @@ namespace Elsa.Telnyx.Activities;
|
|||
public class FlowPlayAudio : PlayAudioBase
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public FlowPlayAudio([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
@ -35,6 +37,7 @@ public class FlowPlayAudio : PlayAudioBase
|
|||
public class PlayAudio : PlayAudioBase
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public PlayAudio([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using Elsa.Telnyx.Attributes;
|
||||
using Elsa.Telnyx.Bookmarks;
|
||||
using Elsa.Telnyx.Client.Models;
|
||||
|
|
@ -132,6 +133,7 @@ public abstract class SpeakTextBase : ActivityBase
|
|||
public class FlowSpeakText : SpeakTextBase
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public FlowSpeakText([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
@ -147,6 +149,7 @@ public class FlowSpeakText : SpeakTextBase
|
|||
public class SpeakText : SpeakTextBase
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public SpeakText([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using Elsa.Telnyx.Attributes;
|
||||
using Elsa.Telnyx.Bookmarks;
|
||||
using Elsa.Telnyx.Client.Models;
|
||||
|
|
@ -20,6 +21,7 @@ namespace Elsa.Telnyx.Activities;
|
|||
public class FlowStartRecording : StartRecordingBase
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public FlowStartRecording([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
@ -35,6 +37,7 @@ public class FlowStartRecording : StartRecordingBase
|
|||
public class StartRecording : StartRecordingBase
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public StartRecording([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using Elsa.Telnyx.Client.Models;
|
||||
using Elsa.Telnyx.Client.Services;
|
||||
using Elsa.Telnyx.Extensions;
|
||||
|
|
@ -16,6 +17,7 @@ namespace Elsa.Telnyx.Activities;
|
|||
public class FlowStopAudioPlayback : StopAudioPlaybackBase
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public FlowStopAudioPlayback([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
@ -31,6 +33,7 @@ public class FlowStopAudioPlayback : StopAudioPlaybackBase
|
|||
public class StopAudioPlayback : StopAudioPlaybackBase
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public StopAudioPlayback([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using Elsa.Telnyx.Client.Models;
|
||||
using Elsa.Telnyx.Client.Services;
|
||||
using Elsa.Telnyx.Extensions;
|
||||
|
|
@ -18,6 +19,7 @@ namespace Elsa.Telnyx.Activities;
|
|||
public class StopRecording : ActivityBase
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public StopRecording([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using Elsa.Telnyx.Client.Models;
|
||||
using Elsa.Telnyx.Client.Services;
|
||||
using Elsa.Telnyx.Extensions;
|
||||
|
|
@ -20,6 +21,7 @@ namespace Elsa.Telnyx.Activities;
|
|||
public class TransferCall : Activity
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public TransferCall([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using Elsa.Workflows.Core.Attributes;
|
||||
using Elsa.Workflows.Core.Models;
|
||||
using Elsa.Workflows.Core.Signals;
|
||||
|
|
@ -11,6 +12,12 @@ namespace Elsa.Workflows.Core.Activities;
|
|||
[Activity("Elsa", "Control Flow", "Break out of a loop.")]
|
||||
public class Break : Activity
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public Break()
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Break([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,18 +1,23 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using Elsa.Workflows.Core.Attributes;
|
||||
using Elsa.Workflows.Core.Behaviors;
|
||||
using Elsa.Workflows.Core.Models;
|
||||
|
||||
namespace Elsa.Workflows.Core.Activities;
|
||||
|
||||
[Activity("Elsa", "Control Flow", "Mark the workflow as Finished")]
|
||||
public class Finish : Activity
|
||||
/// <summary>
|
||||
/// Mark the workflow as finished.
|
||||
/// </summary>
|
||||
[Activity("Elsa", "Control Flow", "Mark the workflow as finished.")]
|
||||
public class Finish : ActivityBase
|
||||
{
|
||||
public Finish()
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public Finish([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
// Don't let ancestor activities schedule additional work.
|
||||
Behaviors.Remove<AutoCompleteBehavior>();
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Execute(ActivityExecutionContext context)
|
||||
{
|
||||
context.ClearCompletionCallbacks();
|
||||
|
|
|
|||
|
|
@ -8,6 +8,9 @@ using Elsa.Workflows.Core.Services;
|
|||
|
||||
namespace Elsa.Workflows.Core.Activities;
|
||||
|
||||
/// <summary>
|
||||
/// Iterate over a sequence of steps between a start and an end number.
|
||||
/// </summary>
|
||||
[Activity("Elsa", "Control Flow", "Iterate over a sequence of steps between a start and an end number.")]
|
||||
public class For : ActivityBase
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ public class ForEach : ActivityBase
|
|||
private const string CurrentIndexProperty = "CurrentIndex";
|
||||
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public ForEach([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default)
|
||||
{
|
||||
Behaviors.Add<BreakBehavior>(this);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ using Elsa.Workflows.Core.Attributes;
|
|||
using Elsa.Workflows.Core.Behaviors;
|
||||
using Elsa.Workflows.Core.Models;
|
||||
using Elsa.Workflows.Core.Services;
|
||||
using Elsa.Workflows.Core.Signals;
|
||||
|
||||
namespace Elsa.Workflows.Core.Activities;
|
||||
|
||||
|
|
@ -20,6 +21,7 @@ public class Fork : ActivityBase
|
|||
[JsonConstructor]
|
||||
public Fork([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
OnSignalReceived<BreakSignal>(OnBreakAsync);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -75,7 +77,6 @@ public class Fork : ActivityBase
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private void RemoveBookmarks(ActivityExecutionContext context)
|
||||
{
|
||||
// Find all descendants for each branch and remove them as well as any associated bookmarks.
|
||||
|
|
@ -86,4 +87,11 @@ public class Fork : ActivityBase
|
|||
|
||||
workflowExecutionContext.Bookmarks.RemoveWhere(x => branchDescendantActivityIds.Contains(x.ActivityId));
|
||||
}
|
||||
|
||||
private async ValueTask OnBreakAsync(BreakSignal signal, SignalContext context)
|
||||
{
|
||||
RemoveBookmarks(context.ReceiverActivityExecutionContext);
|
||||
await CompleteAsync(context.ReceiverActivityExecutionContext);
|
||||
context.StopPropagation();
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,10 @@ using Elsa.Workflows.Core.Services;
|
|||
|
||||
namespace Elsa.Workflows.Core.Activities;
|
||||
|
||||
[Activity("Elsa", "Control Flow", "Evaluate a Boolean condition to determine which path to execute next.")]
|
||||
/// <summary>
|
||||
/// Evaluate a Boolean condition to determine which activity to execute next.
|
||||
/// </summary>
|
||||
[Activity("Elsa", "Control Flow", "Evaluate a Boolean condition to determine which activity to execute next.")]
|
||||
public class If : ActivityBase<bool>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
|
|
|
|||
|
|
@ -13,15 +13,18 @@ public class Inline : Activity
|
|||
{
|
||||
private readonly Func<ActivityExecutionContext, ValueTask> _activity;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Inline(Func<ActivityExecutionContext, ValueTask> activity, [CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
_activity = activity;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Inline(Func<ValueTask> activity, [CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : this(_ => activity(), source, line)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Inline(Action<ActivityExecutionContext> activity, [CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : this(c =>
|
||||
{
|
||||
activity(c);
|
||||
|
|
@ -30,6 +33,7 @@ public class Inline : Activity
|
|||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Inline(Action activity, [CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : this(c =>
|
||||
{
|
||||
activity();
|
||||
|
|
@ -38,16 +42,47 @@ public class Inline : Activity
|
|||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override async ValueTask ExecuteAsync(ActivityExecutionContext context) => await _activity(context);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Inline"/> activity from the specified delegate.
|
||||
/// </summary>
|
||||
public static Inline From(Func<ActivityExecutionContext, ValueTask> activity) => new(activity);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Inline"/> activity from the specified delegate.
|
||||
/// </summary>
|
||||
public static Inline From(Func<ValueTask> activity) => new(activity);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Inline"/> activity from the specified delegate.
|
||||
/// </summary>
|
||||
public static Inline From(Action<ActivityExecutionContext> activity) => new(activity);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Inline"/> activity from the specified delegate.
|
||||
/// </summary>
|
||||
public static Inline From(Action activity) => new(activity);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Inline"/> activity from the specified delegate.
|
||||
/// </summary>
|
||||
public static Inline<T> From<T>(Func<ActivityExecutionContext, ValueTask<T>> activity) => new(activity);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Inline"/> activity from the specified delegate.
|
||||
/// </summary>
|
||||
public static Inline<T> From<T>(Func<ValueTask<T>> activity) => new(activity);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Inline"/> activity from the specified delegate.
|
||||
/// </summary>
|
||||
public static Inline<T> From<T>(Func<ActivityExecutionContext, T> activity) => new(activity);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Inline"/> activity from the specified delegate.
|
||||
/// </summary>
|
||||
public static Inline<T> From<T>(Func<T> activity) => new(activity);
|
||||
}
|
||||
|
||||
|
|
@ -58,17 +93,20 @@ public class Inline<T> : Activity<T>
|
|||
{
|
||||
private readonly Func<ActivityExecutionContext, ValueTask<T>> _activity;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Inline(Func<ActivityExecutionContext, ValueTask<T>> activity, MemoryBlockReference? output = default, [CallerFilePath] string? source = default, [CallerLineNumber] int? line = default)
|
||||
: base(output, source, line)
|
||||
{
|
||||
_activity = activity;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Inline(Func<ValueTask<T>> activity, MemoryBlockReference? output = default, [CallerFilePath] string? source = default, [CallerLineNumber] int? line = default)
|
||||
: this(_ => activity(), output, source, line)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Inline(Func<ActivityExecutionContext, T> activity, MemoryBlockReference? output = default, [CallerFilePath] string? source = default, [CallerLineNumber] int? line = default)
|
||||
: this(c =>
|
||||
{
|
||||
|
|
@ -78,6 +116,7 @@ public class Inline<T> : Activity<T>
|
|||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Inline(Func<T> activity, MemoryBlockReference? output = default, [CallerFilePath] string? source = default, [CallerLineNumber] int? line = default)
|
||||
: this(c =>
|
||||
{
|
||||
|
|
@ -86,7 +125,8 @@ public class Inline<T> : Activity<T>
|
|||
}, output, source, line)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override async ValueTask ExecuteAsync(ActivityExecutionContext context)
|
||||
{
|
||||
var result = await _activity(context);
|
||||
|
|
|
|||
|
|
@ -3,13 +3,18 @@ using Elsa.Workflows.Core.Models;
|
|||
|
||||
namespace Elsa.Workflows.Core.Activities;
|
||||
|
||||
/// <summary>
|
||||
/// This activity is instantiated in case a workflow references an activity type that could not be found.
|
||||
/// </summary>
|
||||
[Browsable(false)]
|
||||
public class NotFoundActivity : Activity
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public NotFoundActivity()
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public NotFoundActivity(string missingTypeName)
|
||||
{
|
||||
MissingTypeName = missingTypeName;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using Elsa.Expressions.Models;
|
||||
using Elsa.Workflows.Core.Attributes;
|
||||
using Elsa.Workflows.Core.Models;
|
||||
|
|
@ -16,6 +17,7 @@ public class ParallelForEach<T> : Activity
|
|||
private const string CollectedCountProperty = nameof(CollectedCountProperty);
|
||||
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public ParallelForEach([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using Elsa.Expressions.Models;
|
||||
using Elsa.Workflows.Core.Attributes;
|
||||
using Elsa.Workflows.Core.Implementations;
|
||||
|
|
@ -14,6 +15,7 @@ namespace Elsa.Workflows.Core.Activities;
|
|||
public class ReadLine : Activity<string>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public ReadLine([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using Elsa.Workflows.Core.Attributes;
|
||||
using Elsa.Workflows.Core.Models;
|
||||
using Elsa.Workflows.Core.Services;
|
||||
|
|
@ -17,6 +18,7 @@ public class Sequence : Container
|
|||
private const string CurrentIndexProperty = "CurrentIndex";
|
||||
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public Sequence([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
OnSignalReceived<BreakSignal>(OnBreak);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using Elsa.Expressions.Models;
|
||||
using Elsa.Workflows.Core.Attributes;
|
||||
using Elsa.Workflows.Core.Models;
|
||||
|
|
@ -14,6 +15,7 @@ namespace Elsa.Workflows.Core.Activities;
|
|||
public class SetVariable<T> : Activity
|
||||
{
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public SetVariable([CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,11 +11,15 @@ namespace Elsa.Workflows.Core.Activities;
|
|||
[Activity("Elsa", "Primitives", "Execute an activity while a given condition evaluates to true.")]
|
||||
public class While : Activity
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a <see cref="While"/> activity that loops forever.
|
||||
/// </summary>
|
||||
public static While True(IActivity body) => new(body)
|
||||
{
|
||||
Condition = new Input<bool>(true)
|
||||
};
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
[JsonConstructor]
|
||||
public While(IActivity? body = default, [CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : base(source, line)
|
||||
{
|
||||
|
|
@ -24,26 +28,31 @@ public class While : Activity
|
|||
Behaviors.Remove<AutoCompleteBehavior>();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public While(Input<bool> condition, IActivity? body = default, [CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : this(body, source, line)
|
||||
{
|
||||
Condition = condition;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public While(Func<ExpressionExecutionContext, ValueTask<bool>> condition, IActivity? body = default, [CallerFilePath] string? source = default, [CallerLineNumber] int? line = default)
|
||||
: this(new Input<bool>(condition), body, source, line)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public While(Func<ExpressionExecutionContext, bool> condition, IActivity? body = default, [CallerFilePath] string? source = default, [CallerLineNumber] int? line = default)
|
||||
: this(new Input<bool>(condition), body, source, line)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public While(Func<ValueTask<bool>> condition, IActivity? body = default, [CallerFilePath] string? source = default, [CallerLineNumber] int? line = default)
|
||||
: this(new Input<bool>(condition), body, source, line)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public While(Func<bool> condition, IActivity? body = default, [CallerFilePath] string? source = default, [CallerLineNumber] int? line = default)
|
||||
: this(new Input<bool>(condition), body, source, line)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using Elsa.Expressions.Models;
|
||||
using Elsa.Workflows.Core.Attributes;
|
||||
using Elsa.Workflows.Core.Implementations;
|
||||
|
|
@ -20,7 +21,13 @@ public class WriteLine : Activity
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public WriteLine(string text = default!, [CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : this(new Literal<string>(text), source, line)
|
||||
[JsonConstructor]
|
||||
public WriteLine()
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public WriteLine(string text, [CallerFilePath] string? source = default, [CallerLineNumber] int? line = default) : this(new Literal<string>(text), source, line)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue