Restructure models in Workflows.Core

This commit is contained in:
Sipke Schoorstra 2023-07-09 13:12:13 +02:00
parent 535fbde514
commit fe2a897a30
170 changed files with 316 additions and 46 deletions

View file

@ -3,6 +3,7 @@ using Elsa.AzureServiceBus.Models;
using Elsa.Common.Contracts;
using Elsa.Expressions.Models;
using Elsa.Extensions;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Models;

View file

@ -2,6 +2,7 @@ using Azure.Messaging.ServiceBus;
using Elsa.Common.Contracts;
using Elsa.Common.Services;
using Elsa.Extensions;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Models;
using JetBrains.Annotations;

View file

@ -8,6 +8,7 @@ using Elsa.Dapper.Modules.Management.Records;
using Elsa.Dapper.Services;
using Elsa.Extensions;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Management.Contracts;
using Elsa.Workflows.Management.Entities;

View file

@ -6,6 +6,7 @@ using Elsa.Dapper.Models;
using Elsa.Dapper.Modules.Management.Records;
using Elsa.Dapper.Services;
using Elsa.Extensions;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Management.Contracts;

View file

@ -2,6 +2,7 @@ using Elsa.Dapper.Contracts;
using Elsa.Dapper.Extensions;
using Elsa.Dapper.Modules.Runtime.Records;
using Elsa.Dapper.Services;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Core.State;

View file

@ -1,4 +1,5 @@
using Elsa.Dsl.Contracts;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Models;

View file

@ -1,4 +1,5 @@
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
namespace Elsa.Dsl.Interpreters;

View file

@ -1,4 +1,5 @@
using System.Linq.Expressions;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Management.Entities;
using Microsoft.EntityFrameworkCore;

View file

@ -2,6 +2,7 @@ using Elsa.Common.Models;
using Elsa.EntityFrameworkCore.Common;
using Elsa.Extensions;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Management.Contracts;
using Elsa.Workflows.Management.Entities;

View file

@ -1,3 +1,4 @@
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Core.State;
using Elsa.Workflows.Runtime.Entities;

View file

@ -1,5 +1,6 @@
using Elsa.Common.Contracts;
using Elsa.EntityFrameworkCore.Common;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Core.State;

View file

@ -1,4 +1,5 @@
using Elsa.Http.Contracts;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Models;
// ReSharper disable once CheckNamespace

View file

@ -1,3 +1,5 @@
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
// ReSharper disable once CheckNamespace

View file

@ -12,6 +12,7 @@ using System.Net;
using System.Net.Mime;
using System.Text.Json;
using Elsa.Extensions;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.State;
namespace Elsa.Http.Middleware;

View file

@ -1,4 +1,5 @@
using Elsa.Extensions;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Models;

View file

@ -4,6 +4,7 @@ using Elsa.Extensions;
using Elsa.JavaScript.Notifications;
using Elsa.Mediator.Contracts;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
using Humanizer;
using JetBrains.Annotations;

View file

@ -8,6 +8,7 @@ using Elsa.JavaScript.Extensions;
using Elsa.JavaScript.Notifications;
using Elsa.JavaScript.Options;
using Elsa.Mediator.Contracts;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
using Humanizer;
using Jint;

View file

@ -5,6 +5,7 @@ using Elsa.Liquid.Helpers;
using Elsa.Liquid.Notifications;
using Elsa.Liquid.Options;
using Elsa.Mediator.Contracts;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Management.Options;
using Fluid;

View file

@ -1,4 +1,5 @@
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Models;
namespace Elsa.Liquid.Helpers;

View file

@ -3,6 +3,7 @@ using System.Text.Json.Serialization;
using Elsa.Expressions.Models;
using Elsa.Extensions;
using Elsa.MassTransit.Implementations;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Models;
namespace Elsa.MassTransit.Activities;

View file

@ -3,6 +3,7 @@ using System.Text.Json.Serialization;
using Elsa.Expressions.Helpers;
using Elsa.Extensions;
using Elsa.MassTransit.Implementations;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Models;
using MassTransit;

View file

@ -2,6 +2,7 @@ using Elsa.Features.Abstractions;
using Elsa.Features.Services;
using Elsa.MongoDB.Options;
using Elsa.MongoDb.Serializers;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;

View file

@ -1,5 +1,6 @@
using Elsa.Common.Contracts;
using Elsa.MongoDb.Common;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Core.State;

View file

@ -1,4 +1,5 @@
using Elsa.Expressions.Services;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Core.Services;
using Microsoft.Extensions.Logging.Abstractions;

View file

@ -10,7 +10,7 @@ using Proto;
using Proto.Cluster;
using Proto.Persistence;
using Exception = System.Exception;
using WorkflowStatus = Elsa.Workflows.Core.Models.WorkflowStatus;
using WorkflowStatus = Elsa.Workflows.Core.WorkflowStatus;
using ProtoBookmark = Elsa.ProtoActor.Protos.Bookmark;
namespace Elsa.ProtoActor.Grains;

View file

@ -5,7 +5,7 @@ using Elsa.ProtoActor.Grains;
using Elsa.ProtoActor.Protos;
using Elsa.Workflows.Core.Notifications;
using Proto.Cluster;
using WorkflowStatus = Elsa.Workflows.Core.Models.WorkflowStatus;
using WorkflowStatus = Elsa.Workflows.Core.WorkflowStatus;
namespace Elsa.ProtoActor.Handlers;

View file

@ -1,4 +1,4 @@
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Core;
using ProtoWorkflowStatus = Elsa.ProtoActor.Protos.WorkflowStatus;
namespace Elsa.ProtoActor.Mappers;

View file

@ -1,4 +1,4 @@
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Core;
using ProtoWorkflowSubStatus = Elsa.ProtoActor.Protos.WorkflowSubStatus;
namespace Elsa.ProtoActor.Mappers;

View file

@ -2,6 +2,7 @@
using System.Text.Json.Serialization;
using Elsa.Extensions;
using Elsa.Scheduling.Contracts;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Models;

View file

@ -3,7 +3,9 @@ using System.Text.Json.Serialization;
using Elsa.Common.Contracts;
using Elsa.Expressions.Models;
using Elsa.Extensions;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
namespace Elsa.Scheduling.Activities;

View file

@ -3,7 +3,9 @@ using System.Text.Json.Serialization;
using Elsa.Common.Contracts;
using Elsa.Expressions.Models;
using Elsa.Extensions;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
using Microsoft.Extensions.Logging;

View file

@ -2,6 +2,7 @@
using System.Text.Json.Serialization;
using Elsa.Common.Contracts;
using Elsa.Extensions;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Models;

View file

@ -7,6 +7,7 @@ using Elsa.Telnyx.Client.Models;
using Elsa.Telnyx.Client.Services;
using Elsa.Telnyx.Extensions;
using Elsa.Telnyx.Payloads.Call;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Activities.Flowchart.Attributes;
using Elsa.Workflows.Core.Activities.Flowchart.Models;
using Elsa.Workflows.Core.Attributes;

View file

@ -6,6 +6,7 @@ using Elsa.Telnyx.Client.Models;
using Elsa.Telnyx.Client.Services;
using Elsa.Telnyx.Extensions;
using Elsa.Telnyx.Payloads.Call;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Activities.Flowchart.Attributes;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Contracts;

View file

@ -7,6 +7,7 @@ using Elsa.Telnyx.Client.Models;
using Elsa.Telnyx.Client.Services;
using Elsa.Telnyx.Extensions;
using Elsa.Telnyx.Payloads.Call;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Activities.Flowchart.Attributes;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Models;

View file

@ -2,6 +2,7 @@
using System.Text.Json.Serialization;
using Elsa.Extensions;
using Elsa.Telnyx.Client.Services;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Activities.Flowchart.Attributes;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Models;

View file

@ -4,6 +4,7 @@ using Elsa.Extensions;
using Elsa.Telnyx.Client.Models;
using Elsa.Telnyx.Client.Services;
using Elsa.Telnyx.Extensions;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Activities.Flowchart.Attributes;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Contracts;

View file

@ -4,6 +4,7 @@ using Elsa.Extensions;
using Elsa.Telnyx.Client.Models;
using Elsa.Telnyx.Client.Services;
using Elsa.Telnyx.Extensions;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Activities.Flowchart.Attributes;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Contracts;

View file

@ -4,6 +4,7 @@ using Elsa.Extensions;
using Elsa.Telnyx.Client.Models;
using Elsa.Telnyx.Client.Services;
using Elsa.Telnyx.Extensions;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Activities.Flowchart.Attributes;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Models;

View file

@ -6,7 +6,9 @@ using Elsa.Telnyx.Bookmarks;
using Elsa.Telnyx.Helpers;
using Elsa.Telnyx.Models;
using Elsa.Telnyx.Payloads.Abstract;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
namespace Elsa.Telnyx.Activities;

View file

@ -1,5 +1,6 @@
using Elsa.Extensions;
using Elsa.Telnyx.Models;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Models;
namespace Elsa.Telnyx.Extensions;

View file

@ -5,6 +5,7 @@ using Elsa.Telnyx.Activities;
using Elsa.Telnyx.Attributes;
using Elsa.Telnyx.Helpers;
using Elsa.Telnyx.Payloads.Abstract;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Management.Extensions;

View file

@ -1,4 +1,5 @@
using Elsa.WorkflowContexts.Contracts;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Models;
using JetBrains.Annotations;

View file

@ -3,6 +3,7 @@ using System.Text.Json.Serialization;
using Elsa.Expressions.Models;
using Elsa.Extensions;
using Elsa.WorkflowContexts.Contracts;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Models;
using JetBrains.Annotations;

View file

@ -1,4 +1,5 @@
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Models;
namespace Elsa.WorkflowContexts.Contracts;

View file

@ -1,5 +1,6 @@
using Elsa.Expressions.Models;
using Elsa.WorkflowContexts.Contracts;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Models;
using JetBrains.Annotations;

View file

@ -1,5 +1,6 @@
using Elsa.Extensions;
using Elsa.WorkflowContexts.Contracts;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Core.Pipelines.ActivityExecution;

View file

@ -1,5 +1,6 @@
using Elsa.Extensions;
using Elsa.WorkflowContexts.Contracts;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Core.Pipelines.WorkflowExecution;
using Microsoft.Extensions.DependencyInjection;

View file

@ -6,6 +6,7 @@ using Elsa.JavaScript.TypeDefinitions.Builders;
using Elsa.JavaScript.TypeDefinitions.Contracts;
using Elsa.JavaScript.TypeDefinitions.Models;
using Elsa.Mediator.Contracts;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Models;
namespace Elsa.WorkflowContexts.Scripting.JavaScript;

View file

@ -2,6 +2,7 @@ using System.Net.Mime;
using Elsa.Abstractions;
using Elsa.Common.Models;
using Elsa.Http.Contracts;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Core.State;

View file

@ -1,3 +1,4 @@
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Core.State;

View file

@ -2,6 +2,7 @@ using Elsa.Abstractions;
using Elsa.Common.Entities;
using Elsa.Common.Models;
using Elsa.Workflows.Api.Models;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Management.Contracts;
using Elsa.Workflows.Management.Filters;

View file

@ -1,5 +1,6 @@
using Elsa.Common.Entities;
using Elsa.Workflows.Api.Models;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Management.Models;

View file

@ -4,8 +4,9 @@ using Elsa.Extensions;
using Elsa.Workflows.Core.Behaviors;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Helpers;
using Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core;
/// <summary>
/// Base class for custom activities.
@ -58,7 +59,7 @@ public abstract class Activity : IActivity, ISignalHandler
/// <summary>
/// A flag indicating if this activity should execute synchronously or asynchronously.
/// By default, activities with an <see cref="Workflows.Core.Models.ActivityKind"/> of <see cref="Workflows.Core.Models.ActivityKind.Action"/>, <see cref="Workflows.Core.Models.ActivityKind.Task"/> or <see cref="Workflows.Core.Models.ActivityKind.Trigger"/>
/// By default, activities with an <see cref="Workflows.Core.Models.ActivityKind"/> of <see cref="Action"/>, <see cref="Task"/> or <see cref="Trigger"/>
/// will execute synchronously, while activities of the <see cref="Workflows.Core.Models.ActivityKind.Job"/> kind will execute asynchronously.
/// </summary>
[JsonIgnore]

View file

@ -1,7 +1,8 @@
using Elsa.Expressions.Models;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core;
/// <summary>
/// Base class for custom activities that return a result.

View file

@ -1,6 +1,7 @@
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core;
public abstract class Behavior : IBehavior
{

View file

@ -3,9 +3,10 @@ using Elsa.Extensions;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Behaviors;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Models;
using JetBrains.Annotations;
namespace Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core;
/// <summary>
/// Base class for custom activities with auto-complete behavior.

View file

@ -1,6 +1,6 @@
using Elsa.Workflows.Core.Contracts;
namespace Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core;
/// <summary>
/// Represents an activity that acts as a workflow trigger.

View file

@ -1,4 +1,5 @@
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core.Abstractions;

View file

@ -6,6 +6,7 @@ using Elsa.Extensions;
using Elsa.Workflows.Core.Activities.Flowchart.Models;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Core.Signals;
using JetBrains.Annotations;

View file

@ -1,6 +1,7 @@
using System.Collections.ObjectModel;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core.Activities;

View file

@ -3,6 +3,7 @@ using System.Text.Json.Serialization;
using Elsa.Expressions.Models;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
using JetBrains.Annotations;

View file

@ -4,6 +4,7 @@ using System.Text.Json.Serialization;
using Elsa.Expressions.Models;
using Elsa.Extensions;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
using JetBrains.Annotations;

View file

@ -3,6 +3,7 @@ using Elsa.Expressions.Models;
using Elsa.Workflows.Core.Activities;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Memory;
using JetBrains.Annotations;
namespace Elsa.Workflows.Core.Models;

View file

@ -4,6 +4,7 @@ using System.Text.Json.Serialization;
using Elsa.Expressions.Models;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Core.Services;

View file

@ -1,7 +1,9 @@
using Elsa.Workflows.Core.Serialization.Converters;
namespace Elsa.Workflows.Core.Attributes;
/// <summary>
/// Used by <see cref="JsonIgnoreCompositeRootConverter{T}"/> to indicate that the property should be expanded into a JSON object.
/// Used by <see cref="JsonIgnoreCompositeRootConverter"/> to indicate that the property should be expanded into a JSON object.
/// </summary>
[AttributeUsage(AttributeTargets.Property)]
public class JsonIgnoreCompositeRootAttribute : Attribute

View file

@ -1,6 +1,7 @@
using Elsa.Extensions;
using Elsa.Workflows.Core.Activities;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core.Builders;

View file

@ -4,9 +4,11 @@ using Elsa.Expressions.Helpers;
using Elsa.Expressions.Models;
using Elsa.Extensions;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Core.Services;
namespace Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core;
/// <summary>
/// Represents the context of an activity execution.
@ -73,6 +75,8 @@ public class ActivityExecutionContext : IExecutionContext
/// A cancellation token to use when invoking asynchronous operations.
/// </summary>
public CancellationToken CancellationToken { get; }
public ActivityStatus Status { get; set; }
/// <inheritdoc />
public IDictionary<string, object> Properties { get; set; } = new Dictionary<string, object>();
@ -126,23 +130,49 @@ public class ActivityExecutionContext : IExecutionContext
/// </summary>
public IDictionary<string, object> ActivityState { get; set; } = new Dictionary<string, object>();
/// <summary>
/// Schedules the specified activity to be executed.
/// </summary>
/// <param name="activity">The activity to schedule.</param>
/// <param name="completionCallback">An optional callback that is invoked when the activity completes.</param>
/// <param name="tag">An optional tag that can be used to identify the activity.</param>
public async ValueTask ScheduleActivityAsync(IActivity? activity, ActivityCompletionCallback? completionCallback = default, object? tag = default)
{
var activityNode = activity != null ? WorkflowExecutionContext.FindNodeByActivity(activity) : default;
await ScheduleActivityAsync(activityNode, completionCallback, tag);
}
/// <summary>
/// Schedules the specified activity to be executed.
/// </summary>
/// <param name="activity">The activity to schedule.</param>
/// <param name="owner">The activity execution context that owns the activity.</param>
/// <param name="completionCallback">An optional callback that is invoked when the activity completes.</param>
/// <param name="tag">An optional tag that can be used to identify the activity.</param>
public async ValueTask ScheduleActivityAsync(IActivity? activity, ActivityExecutionContext owner, ActivityCompletionCallback? completionCallback = default, object? tag = default)
{
var activityNode = activity != null ? WorkflowExecutionContext.FindNodeByActivity(activity) : default;
await ScheduleActivityAsync(activityNode, this, completionCallback, tag);
}
/// <summary>
/// Schedules the specified activity to be executed.
/// </summary>
/// <param name="activityNode">The activity node to schedule.</param>
/// <param name="completionCallback">An optional callback that is invoked when the activity completes.</param>
/// <param name="tag">An optional tag that can be used to identify the activity.</param>
public async ValueTask ScheduleActivityAsync(ActivityNode? activityNode, ActivityCompletionCallback? completionCallback = default, object? tag = default)
{
await ScheduleActivityAsync(activityNode, this, completionCallback, tag);
}
/// <summary>
/// Schedules the specified activity to be executed.
/// </summary>
/// <param name="activityNode">The activity node to schedule.</param>
/// <param name="owner">The activity execution context that owns the activity.</param>
/// <param name="completionCallback">An optional callback that is invoked when the activity completes.</param>
/// <param name="tag">An optional tag that can be used to identify the activity.</param>
public async ValueTask ScheduleActivityAsync(ActivityNode? activityNode, ActivityExecutionContext owner, ActivityCompletionCallback? completionCallback = default, object? tag = default)
{
if (activityNode == null)
@ -157,25 +187,67 @@ public class ActivityExecutionContext : IExecutionContext
WorkflowExecutionContext.Schedule(activityNode, owner, completionCallback, tag);
}
/// <summary>
/// Schedules the specified activities to be executed.
/// </summary>
/// <param name="activities">The activities to schedule.</param>
public async ValueTask ScheduleActivitiesAsync(params IActivity?[] activities) => await ScheduleActivities(activities);
/// <summary>
/// Schedules the specified activities to be executed.
/// </summary>
/// <param name="activities">The activities to schedule.</param>
/// <param name="completionCallback">An optional callback that is invoked for each activity when it completes.</param>
public async ValueTask ScheduleActivities(IEnumerable<IActivity?> activities, ActivityCompletionCallback? completionCallback = default)
{
foreach (var activity in activities)
await ScheduleActivityAsync(activity, completionCallback);
}
/// <summary>
/// Creates a bookmark for each payload.
/// </summary>
/// <param name="payloads">The payloads to create bookmarks for.</param>
/// <param name="callback">An optional callback that is invoked when the bookmark is resumed.</param>
public void CreateBookmarks(IEnumerable<object> payloads, ExecuteActivityDelegate? callback = default)
{
foreach (var payload in payloads)
CreateBookmark(new BookmarkOptions(payload, callback));
}
/// <summary>
/// Adds each bookmark to the list of bookmarks.
/// </summary>
/// <param name="bookmarks">The bookmarks to add.</param>
public void AddBookmarks(IEnumerable<Bookmark> bookmarks) => _bookmarks.AddRange(bookmarks);
/// <summary>
/// Adds a bookmark to the list of bookmarks.
/// </summary>
/// <param name="bookmark">The bookmark to add.</param>
public void AddBookmark(Bookmark bookmark) => _bookmarks.Add(bookmark);
/// <summary>
/// Creates a bookmark so that this activity can be resumed at a later time.
/// </summary>
/// <param name="callback">An optional callback that is invoked when the bookmark is resumed.</param>
/// <returns>The created bookmark.</returns>
public Bookmark CreateBookmark(ExecuteActivityDelegate callback) => CreateBookmark(new BookmarkOptions(default, callback));
/// <summary>
/// Creates a bookmark so that this activity can be resumed at a later time.
/// </summary>
/// <param name="payload">The payload to associate with the bookmark.</param>
/// <param name="callback">An optional callback that is invoked when the bookmark is resumed.</param>
/// <returns>The created bookmark.</returns>
public Bookmark CreateBookmark(object payload, ExecuteActivityDelegate callback) => CreateBookmark(new BookmarkOptions(payload, callback));
/// <summary>
/// Creates a bookmark so that this activity can be resumed at a later time.
/// </summary>
/// <param name="payload">The payload to associate with the bookmark.</param>
/// <returns>The created bookmark.</returns>
public Bookmark CreateBookmark(object payload) => CreateBookmark(new BookmarkOptions(payload));
/// <summary>

View file

@ -0,0 +1,5 @@
using Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core;
public record ResumedBookmarkContext(Bookmark Bookmark);

View file

@ -1,8 +1,9 @@
using Elsa.Expressions.Models;
using Elsa.Extensions;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core;
public class TriggerIndexingContext
{

View file

@ -5,9 +5,11 @@ using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Services;
using Microsoft.Extensions.DependencyInjection;
using System.Collections.ObjectModel;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
using JetBrains.Annotations;
namespace Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core;
/// <summary>
/// A delegate entry that is used by activities to be notified when the activities they scheduled are completed.

View file

@ -1,7 +1,8 @@
using Elsa.Expressions.Models;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core;
public class WorkflowIndexingContext
{

View file

@ -1,4 +1,5 @@
using Elsa.Expressions.Models;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core.Contracts;

View file

@ -1,3 +1,4 @@
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core.Contracts;

View file

@ -1,3 +1,4 @@
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core.Contracts;

View file

@ -29,4 +29,8 @@
<ProjectReference Include="..\Elsa.Mediator\Elsa.Mediator.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Bookmarks\" />
</ItemGroup>
</Project>

View file

@ -1,4 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=abstractions/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=activities_005Ccontainers_005Cfreeflowchart/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=activities_005Ccontrolflow_005Cfinish/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=activities_005Ccontrolflow_005Cfor/@EntryIndexedValue">True</s:Boolean>
@ -6,4 +7,6 @@
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=activities_005Cprimitives_005Csetname/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=activities_005Csignaling_005Cactivities_005Csignalreceived/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=activities_005Cworkflows_005Cfreeflowchart/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=contexts/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=enums/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=extensions/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View file

@ -1,4 +1,4 @@
namespace Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core;
/// <summary>
/// Represents the kind of an activity, which affects how it is executed.

View file

@ -0,0 +1,17 @@
namespace Elsa.Workflows.Core.Models;
/// <summary>
/// Represents the status of an activity.
/// </summary>
public enum ActivityStatus
{
/// <summary>
/// The activity is in the Running state. Note that event if an activity is running, it may not be executing.
/// </summary>
Running,
/// <summary>
/// The activity is in the Completed state.
/// </summary>
Completed,
}

View file

@ -0,0 +1,17 @@
namespace Elsa.Workflows.Core;
/// <summary>
/// Represents the switch mode.
/// </summary>
public enum SwitchMode
{
/// <summary>
/// Yields the outcome of the first condition evaluating to true.
/// </summary>
MatchFirst,
/// <summary>
/// Yields the outcome of all conditions evaluating to true.
/// </summary>
MatchAny
}

View file

@ -1,5 +1,8 @@
namespace Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core;
/// <summary>
/// Represents the switch mode.
/// </summary>
[Flags]
public enum TypeKind
{

View file

@ -1,4 +1,4 @@
namespace Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core;
/// <summary>
/// Represents the current workflow status.

View file

@ -1,4 +1,4 @@
namespace Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core;
/// <summary>
/// Represents the workflow sub-status.

View file

@ -1,5 +1,6 @@
using Elsa.Expressions.Contracts;
using Elsa.Expressions.Models;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core.Expressions;

View file

@ -7,9 +7,11 @@ using Elsa.Expressions.Contracts;
using Elsa.Expressions.Helpers;
using Elsa.Expressions.Models;
using Elsa.Mediator.Contracts;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Activities.Flowchart.Models;
using Elsa.Workflows.Core.Attributes;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Core.Notifications;
using Elsa.Workflows.Core.Signals;

View file

@ -1,3 +1,4 @@
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Contracts;
// ReSharper disable once CheckNamespace
@ -25,14 +26,14 @@ public static class ActivityPropertyExtensions
/// <summary>
/// Gets a flag indicating if this activity should execute synchronously or asynchronously.
/// By default, activities with an <see cref="Workflows.Core.Models.ActivityKind"/> of <see cref="Workflows.Core.Models.ActivityKind.Action"/>, <see cref="Workflows.Core.Models.ActivityKind.Task"/> or <see cref="Workflows.Core.Models.ActivityKind.Trigger"/>
/// By default, activities with an <see cref="Workflows.Core.Models.ActivityKind"/> of <see cref="Action"/>, <see cref="Task"/> or <see cref="Trigger"/>
/// will execute synchronously, while activities of the <see cref="Workflows.Core.Models.ActivityKind.Job"/> kind will execute asynchronously.
/// </summary>
public static bool GetRunAsynchronously(this IActivity activity) => activity.CustomProperties.GetValueOrDefault(RunAsynchronouslyPropertyName, () => false);
/// <summary>
/// Sets a flag indicating if this activity should execute synchronously or asynchronously.
/// By default, activities with an <see cref="Workflows.Core.Models.ActivityKind"/> of <see cref="Workflows.Core.Models.ActivityKind.Action"/>, <see cref="Workflows.Core.Models.ActivityKind.Task"/> or <see cref="Workflows.Core.Models.ActivityKind.Trigger"/>
/// By default, activities with an <see cref="Workflows.Core.Models.ActivityKind"/> of <see cref="Action"/>, <see cref="Task"/> or <see cref="Trigger"/>
/// will execute synchronously, while activities of the <see cref="Workflows.Core.Models.ActivityKind.Job"/> kind will execute asynchronously.
/// </summary>
public static void SetRunAsynchronously(this IActivity activity, bool value) => activity.CustomProperties[RunAsynchronouslyPropertyName[0]] = value;

View file

@ -1,5 +1,7 @@
using Elsa.Expressions.Helpers;
using Elsa.Expressions.Models;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
// ReSharper disable once CheckNamespace

View file

@ -1,5 +1,6 @@
using System.Runtime.CompilerServices;
using Elsa.Expressions.Models;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Models;
// ReSharper disable once CheckNamespace

View file

@ -1,5 +1,6 @@
using Elsa.Expressions.Helpers;
using Elsa.Expressions.Models;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Models;
// ReSharper disable once CheckNamespace

View file

@ -1,4 +1,6 @@
using Elsa.Expressions.Models;
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
// ReSharper disable once CheckNamespace

View file

@ -1,3 +1,4 @@
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Helpers;
using Elsa.Workflows.Core.Models;

View file

@ -1,3 +1,4 @@
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
// ReSharper disable once CheckNamespace

View file

@ -1,6 +1,7 @@
using System.Text.Json;
using Elsa.Expressions.Helpers;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Core.Serialization.Converters;
using Elsa.Workflows.Core.Services;

View file

@ -1,3 +1,4 @@
using Elsa.Workflows.Core;
using Elsa.Workflows.Core.Contracts;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Core.Services;

View file

@ -1,7 +1,7 @@
using Elsa.Expressions.Models;
using Elsa.Workflows.Core.Expressions;
namespace Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core.Memory;
public class ElsaExpressionBlockReference : MemoryBlockReference
{

View file

@ -2,7 +2,7 @@ using Elsa.Expressions.Helpers;
using Elsa.Expressions.Models;
using Elsa.Workflows.Core.Contracts;
namespace Elsa.Workflows.Core.Models;
namespace Elsa.Workflows.Core.Memory;
public class Variable : MemoryBlockReference
{

View file

@ -3,6 +3,7 @@ using Elsa.Expressions;
using Elsa.Expressions.Contracts;
using Elsa.Expressions.Models;
using Elsa.Workflows.Core.Expressions;
using Elsa.Workflows.Core.Memory;
namespace Elsa.Workflows.Core.Models;

View file

@ -1,3 +0,0 @@
namespace Elsa.Workflows.Core.Models;
public record ResumedBookmarkContext(Bookmark Bookmark);

View file

@ -1,15 +0,0 @@
namespace Elsa.Workflows.Core.Models
{
public enum SwitchMode
{
/// <summary>
/// Yields the outcome of the first condition evaluating to true.
/// </summary>
MatchFirst,
/// <summary>
/// Yields the outcome of all conditions evaluating to true.
/// </summary>
MatchAny
}
}

View file

@ -1,6 +1,7 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using Elsa.Expressions.Contracts;
using Elsa.Workflows.Core.Memory;
using Elsa.Workflows.Core.Models;
using Elsa.Workflows.Core.Services;
using Microsoft.Extensions.Logging;

Some files were not shown because too many files have changed in this diff Show more