Add field "ExternalUserId" to table "WorkflowInstance" and change related classes
This commit is contained in:
+2
@@ -12,6 +12,8 @@ public record WorkflowInstanceSummary
|
||||
/// <summary>The ID of the workflow instance.</summary>
|
||||
public string Id { get; set; } = default!;
|
||||
|
||||
public long? ExternalUserId { get; set; }
|
||||
|
||||
/// <summary>The ID of the workflow definition.</summary>
|
||||
public string DefinitionId { get; set; } = default!;
|
||||
|
||||
|
||||
@@ -12,7 +12,12 @@ public class WorkflowState : Entity
|
||||
/// The workflow definition ID.
|
||||
/// </summary>
|
||||
public string DefinitionId { get; set; } = default!;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// External user's ID.
|
||||
/// </summary>
|
||||
public long? ExternalUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The workflow definition version.
|
||||
/// </summary>
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace Elsa.Dapper.Modules.Management.Records;
|
||||
internal class WorkflowInstanceRecord : Record
|
||||
{
|
||||
public string DefinitionId { get; set; } = null!;
|
||||
public long? ExternalUserId { get; set; }
|
||||
public string DefinitionVersionId { get; set; } = null!;
|
||||
public int Version { get; set; }
|
||||
public string WorkflowState { get; set; } = null!;
|
||||
|
||||
@@ -217,6 +217,7 @@ internal class DapperWorkflowInstanceStore(Store<WorkflowInstanceRecord> store,
|
||||
return new()
|
||||
{
|
||||
Id = source.Id,
|
||||
ExternalUserId = source.ExternalUserId,
|
||||
DefinitionId = source.DefinitionId,
|
||||
DefinitionVersionId = source.DefinitionVersionId,
|
||||
Version = source.Version,
|
||||
@@ -242,6 +243,7 @@ internal class DapperWorkflowInstanceStore(Store<WorkflowInstanceRecord> store,
|
||||
return new()
|
||||
{
|
||||
Id = source.Id,
|
||||
ExternalUserId = source.ExternalUserId,
|
||||
DefinitionId = source.DefinitionId,
|
||||
DefinitionVersionId = source.DefinitionVersionId,
|
||||
Version = source.Version,
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
Terms and Conditions of Use, Reproduction and Distribution are permitted only for Caspian Company.
|
||||
|
||||
Copyright [2025] Caspian Company
|
||||
+235
@@ -0,0 +1,235 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Elsa.EntityFrameworkCore.Modules.Management;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Management
|
||||
{
|
||||
[DbContext(typeof(ManagementElsaDbContext))]
|
||||
[Migration("20250818170340_AddExternalUserId")]
|
||||
partial class AddExternalUserId
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("Elsa")
|
||||
.HasAnnotation("ProductVersion", "9.0.7")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowDefinition", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<byte[]>("BinaryData")
|
||||
.HasColumnType("varbinary(max)");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<string>("Data")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DefinitionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("IsLatest")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsPublished")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsReadonly")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsSystem")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("MaterializerContext")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("MaterializerName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("ProviderName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("StringData")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("TenantId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("ToolVersion")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool?>("UsableAsActivity")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("Version")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IsLatest")
|
||||
.HasDatabaseName("IX_WorkflowDefinition_IsLatest");
|
||||
|
||||
b.HasIndex("IsPublished")
|
||||
.HasDatabaseName("IX_WorkflowDefinition_IsPublished");
|
||||
|
||||
b.HasIndex("IsSystem")
|
||||
.HasDatabaseName("IX_WorkflowDefinition_IsSystem");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.HasDatabaseName("IX_WorkflowDefinition_Name");
|
||||
|
||||
b.HasIndex("TenantId")
|
||||
.HasDatabaseName("IX_WorkflowDefinition_TenantId");
|
||||
|
||||
b.HasIndex("UsableAsActivity")
|
||||
.HasDatabaseName("IX_WorkflowDefinition_UsableAsActivity");
|
||||
|
||||
b.HasIndex("Version")
|
||||
.HasDatabaseName("IX_WorkflowDefinition_Version");
|
||||
|
||||
b.HasIndex("DefinitionId", "Version")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("IX_WorkflowDefinition_DefinitionId_Version");
|
||||
|
||||
b.ToTable("WorkflowDefinitions", "Elsa");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Elsa.Workflows.Management.Entities.WorkflowInstance", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("CorrelationId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<string>("Data")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DataCompressionAlgorithm")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DefinitionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("DefinitionVersionId")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<long?>("ExternalUserId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset?>("FinishedAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<int>("IncidentCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("IsExecuting")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsSystem")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("ParentWorkflowInstanceId")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("SubStatus")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("TenantId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdatedAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<int>("Version")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CorrelationId")
|
||||
.HasDatabaseName("IX_WorkflowInstance_CorrelationId");
|
||||
|
||||
b.HasIndex("CreatedAt")
|
||||
.HasDatabaseName("IX_WorkflowInstance_CreatedAt");
|
||||
|
||||
b.HasIndex("DefinitionId")
|
||||
.HasDatabaseName("IX_WorkflowInstance_DefinitionId");
|
||||
|
||||
b.HasIndex("FinishedAt")
|
||||
.HasDatabaseName("IX_WorkflowInstance_FinishedAt");
|
||||
|
||||
b.HasIndex("IsExecuting")
|
||||
.HasDatabaseName("IX_WorkflowInstance_IsExecuting");
|
||||
|
||||
b.HasIndex("IsSystem")
|
||||
.HasDatabaseName("IX_WorkflowInstance_IsSystem");
|
||||
|
||||
b.HasIndex("Name")
|
||||
.HasDatabaseName("IX_WorkflowInstance_Name");
|
||||
|
||||
b.HasIndex("Status")
|
||||
.HasDatabaseName("IX_WorkflowInstance_Status");
|
||||
|
||||
b.HasIndex("SubStatus")
|
||||
.HasDatabaseName("IX_WorkflowInstance_SubStatus");
|
||||
|
||||
b.HasIndex("TenantId")
|
||||
.HasDatabaseName("IX_WorkflowInstance_TenantId");
|
||||
|
||||
b.HasIndex("UpdatedAt")
|
||||
.HasDatabaseName("IX_WorkflowInstance_UpdatedAt");
|
||||
|
||||
b.HasIndex("Status", "DefinitionId")
|
||||
.HasDatabaseName("IX_WorkflowInstance_Status_DefinitionId");
|
||||
|
||||
b.HasIndex("Status", "SubStatus")
|
||||
.HasDatabaseName("IX_WorkflowInstance_Status_SubStatus");
|
||||
|
||||
b.HasIndex("SubStatus", "DefinitionId")
|
||||
.HasDatabaseName("IX_WorkflowInstance_SubStatus_DefinitionId");
|
||||
|
||||
b.HasIndex("Status", "SubStatus", "DefinitionId", "Version")
|
||||
.HasDatabaseName("IX_WorkflowInstance_Status_SubStatus_DefinitionId_Version");
|
||||
|
||||
b.ToTable("WorkflowInstances", "Elsa");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Management
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddExternalUserId : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "ExternalUserId",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowInstances",
|
||||
type: "bigint",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ExternalUserId",
|
||||
schema: "Elsa",
|
||||
table: "WorkflowInstances");
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-1
@@ -18,7 +18,7 @@ namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Management
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("Elsa")
|
||||
.HasAnnotation("ProductVersion", "8.0.12")
|
||||
.HasAnnotation("ProductVersion", "9.0.7")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
@@ -139,6 +139,9 @@ namespace Elsa.EntityFrameworkCore.SqlServer.Migrations.Management
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<long?>("ExternalUserId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset?>("FinishedAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
dotnet ef migrations add AddExternalUserId --context ManagementElsaDbContext --project D:\CaspianProjects\Caspian.Elsa.Core\src\modules\Elsa.EntityFrameworkCore.SqlServer\Elsa.EntityFrameworkCore.SqlServer.csproj --output-dir Migrations\Management
|
||||
Update-Database -Context ManagementElsaDbContext
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,35 @@
|
||||
# Caspian.NextBank.Workflow
|
||||
|
||||
Workflows for project "NextBankParsian"
|
||||
|
||||
## Installation
|
||||
```bash
|
||||
dotnet add package Caspian.NextBank.Workflow
|
||||
```
|
||||
```bash
|
||||
install-package Caspian.NextBank.Workflow
|
||||
```
|
||||
|
||||
## Usage Example
|
||||
In your Program.cs :
|
||||
```csharp
|
||||
builder.Services.AddMongoLogger<LogModel>(builder.Configuration);
|
||||
|
||||
builder.AddWorkflowServices("DefaultConnection");
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.UseMongoLogger<LogModel>();
|
||||
|
||||
app.UseWorkflow();
|
||||
```
|
||||
Then use service "WfService"
|
||||
|
||||
## Features
|
||||
- Start new instance of every workflow
|
||||
- Publish event and get next step information
|
||||
- Get last status of workflow instance
|
||||
|
||||
## Version History
|
||||
### 1.0.0-alfa
|
||||
- Initial prerelease
|
||||
@@ -114,6 +114,7 @@ public class MassTransitWorkflowDispatcher(
|
||||
var workflowInstanceOptions = new WorkflowInstanceOptions
|
||||
{
|
||||
WorkflowInstanceId = request.WorkflowInstanceId,
|
||||
ExternalUserId = request.ExternalUserId,
|
||||
Input = request.Input,
|
||||
Properties = request.Properties,
|
||||
CorrelationId = request.CorrelationId
|
||||
|
||||
@@ -28,6 +28,7 @@ internal static class ExpressionHelpers
|
||||
workflowInstance => new()
|
||||
{
|
||||
Id = workflowInstance.Id,
|
||||
ExternalUserId = workflowInstance.ExternalUserId,
|
||||
DefinitionId = workflowInstance.DefinitionId,
|
||||
DefinitionVersionId = workflowInstance.DefinitionVersionId,
|
||||
Version = workflowInstance.Version,
|
||||
|
||||
@@ -13,6 +13,7 @@ internal class WorkflowInstanceMapper : ResponseMapper<WorkflowInstanceModel, Wo
|
||||
public override WorkflowInstanceModel FromEntity(WorkflowInstance e) => new()
|
||||
{
|
||||
Id = e.Id,
|
||||
ExternalUserId = e.ExternalUserId,
|
||||
DefinitionId = e.DefinitionId,
|
||||
DefinitionVersionId = e.DefinitionVersionId,
|
||||
Version = e.Version,
|
||||
|
||||
@@ -11,7 +11,9 @@ public class WorkflowInstanceModel
|
||||
/// Gets or sets the ID of the workflow instance.
|
||||
/// </summary>
|
||||
public string Id { get; set; } = default!;
|
||||
|
||||
|
||||
public long? ExternalUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The ID of the workflow definition.
|
||||
/// </summary>
|
||||
|
||||
@@ -258,6 +258,8 @@ public partial class WorkflowExecutionContext : IExecutionContext
|
||||
/// A unique ID of the execution context.
|
||||
public string Id { get; set; }
|
||||
|
||||
public long? ExternalUserId { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public IActivity Activity => Workflow;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ public class WorkflowStateExtractor(ILogger<WorkflowStateExtractor> logger) : IW
|
||||
var state = new WorkflowState
|
||||
{
|
||||
Id = workflowExecutionContext.Id,
|
||||
ExternalUserId = workflowExecutionContext.ExternalUserId,
|
||||
DefinitionId = workflowExecutionContext.Workflow.Identity.DefinitionId,
|
||||
DefinitionVersionId = workflowExecutionContext.Workflow.Identity.Id,
|
||||
DefinitionVersion = workflowExecutionContext.Workflow.Identity.Version,
|
||||
@@ -47,6 +48,7 @@ public class WorkflowStateExtractor(ILogger<WorkflowStateExtractor> logger) : IW
|
||||
public async Task<WorkflowExecutionContext> ApplyAsync(WorkflowExecutionContext workflowExecutionContext, WorkflowState state)
|
||||
{
|
||||
workflowExecutionContext.Id = state.Id;
|
||||
workflowExecutionContext.ExternalUserId = state.ExternalUserId;
|
||||
workflowExecutionContext.CorrelationId = state.CorrelationId;
|
||||
workflowExecutionContext.Name = state.Name;
|
||||
workflowExecutionContext.ParentWorkflowInstanceId = state.ParentWorkflowInstanceId;
|
||||
|
||||
@@ -13,6 +13,11 @@ public class WorkflowState
|
||||
/// </summary>
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// External user's ID.
|
||||
/// </summary>
|
||||
public long? ExternalUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The workflow definition ID.
|
||||
/// </summary>
|
||||
|
||||
@@ -8,6 +8,11 @@ namespace Elsa.Workflows.Management.Entities;
|
||||
/// </summary>
|
||||
public class WorkflowInstance : Entity
|
||||
{
|
||||
/// <summary>
|
||||
/// External user's id
|
||||
/// </summary>
|
||||
public long? ExternalUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The ID of the workflow definition.
|
||||
/// </summary>
|
||||
|
||||
@@ -16,6 +16,8 @@ public class WorkflowInstanceFilter
|
||||
/// </summary>
|
||||
public string? Id { get; set; }
|
||||
|
||||
public long? ExternalUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Filter workflow instances by IDs.
|
||||
/// </summary>
|
||||
@@ -130,6 +132,7 @@ public class WorkflowInstanceFilter
|
||||
var filter = this;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(filter.Id)) query = query.Where(x => x.Id == filter.Id);
|
||||
if (filter.ExternalUserId.HasValue) query = query.Where(x => x.ExternalUserId == filter.ExternalUserId);
|
||||
if (filter.Ids != null) query = query.Where(x => filter.Ids.Contains(x.Id));
|
||||
if (!string.IsNullOrWhiteSpace(filter.DefinitionId)) query = query.Where(x => x.DefinitionId == filter.DefinitionId);
|
||||
if (!string.IsNullOrWhiteSpace(filter.DefinitionVersionId)) query = query.Where(x => x.DefinitionVersionId == filter.DefinitionVersionId);
|
||||
|
||||
@@ -14,7 +14,7 @@ public class WorkflowStateMapper
|
||||
/// </summary>
|
||||
[Obsolete("This constant is obsolete and retained only for backward compatibility. Avoid using it in new code.")]
|
||||
private const string WorkflowInstanceNameKey = "WorkflowInstanceName";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Maps a workflow state to a workflow instance.
|
||||
/// </summary>
|
||||
@@ -35,6 +35,7 @@ public class WorkflowStateMapper
|
||||
public void Apply(WorkflowState source, WorkflowInstance target)
|
||||
{
|
||||
target.Id = source.Id;
|
||||
target.ExternalUserId = source.ExternalUserId;
|
||||
target.CreatedAt = source.CreatedAt;
|
||||
target.DefinitionId = source.DefinitionId;
|
||||
target.DefinitionVersionId = source.DefinitionVersionId;
|
||||
@@ -50,7 +51,7 @@ public class WorkflowStateMapper
|
||||
target.UpdatedAt = source.UpdatedAt;
|
||||
target.FinishedAt = source.FinishedAt;
|
||||
target.WorkflowState = source;
|
||||
|
||||
|
||||
// Keep for backward compatibility with workflow instances created before the introduction of the Name property.
|
||||
if (source.Properties.TryGetValue<string>(WorkflowInstanceNameKey, out var name))
|
||||
target.Name = name;
|
||||
@@ -66,6 +67,7 @@ public class WorkflowStateMapper
|
||||
|
||||
var workflowState = source.WorkflowState;
|
||||
workflowState.Id = source.Id;
|
||||
workflowState.ExternalUserId = source.ExternalUserId;
|
||||
workflowState.CreatedAt = source.CreatedAt;
|
||||
workflowState.DefinitionId = source.DefinitionId;
|
||||
workflowState.DefinitionVersionId = source.DefinitionVersionId;
|
||||
|
||||
@@ -16,6 +16,7 @@ public class WorkflowInstanceSummary
|
||||
return new()
|
||||
{
|
||||
Id = workflowInstance.Id,
|
||||
ExternalUserId = workflowInstance.ExternalUserId,
|
||||
DefinitionId = workflowInstance.DefinitionId,
|
||||
DefinitionVersionId = workflowInstance.DefinitionVersionId,
|
||||
Version = workflowInstance.Version,
|
||||
@@ -36,6 +37,7 @@ public class WorkflowInstanceSummary
|
||||
public static Expression<Func<WorkflowInstance, WorkflowInstanceSummary>> FromInstanceExpression() => workflowInstance => new()
|
||||
{
|
||||
Id = workflowInstance.Id,
|
||||
ExternalUserId = workflowInstance.ExternalUserId,
|
||||
DefinitionId = workflowInstance.DefinitionId,
|
||||
DefinitionVersionId = workflowInstance.DefinitionVersionId,
|
||||
Version = workflowInstance.Version,
|
||||
@@ -53,6 +55,8 @@ public class WorkflowInstanceSummary
|
||||
/// <summary>The ID of the workflow instance.</summary>
|
||||
public string Id { get; set; } = null!;
|
||||
|
||||
public long? ExternalUserId { get; set; }
|
||||
|
||||
/// <summary>The ID of the workflow definition.</summary>
|
||||
public string DefinitionId { get; set; } = null!;
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ public class WorkflowInstanceOptions
|
||||
/// </summary>
|
||||
public string? CorrelationId { get; set; }
|
||||
|
||||
public long? ExternalUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the workflow instance.
|
||||
/// </summary>
|
||||
|
||||
@@ -17,6 +17,7 @@ public class WorkflowInstanceFactory(IIdentityGenerator identityGenerator, ISyst
|
||||
return new()
|
||||
{
|
||||
Id = string.IsNullOrEmpty(options?.WorkflowInstanceId) ? identityGenerator.GenerateId() : options.WorkflowInstanceId,
|
||||
ExternalUserId = options?.ExternalUserId,
|
||||
DefinitionId = workflow.Identity.DefinitionId,
|
||||
DefinitionVersionId = workflow.Identity.Id,
|
||||
DefinitionVersion = workflow.Identity.Version,
|
||||
@@ -40,6 +41,7 @@ public class WorkflowInstanceFactory(IIdentityGenerator identityGenerator, ISyst
|
||||
return new()
|
||||
{
|
||||
Id = workflowState.Id,
|
||||
ExternalUserId = workflowState.ExternalUserId,
|
||||
ParentWorkflowInstanceId = workflowState.ParentWorkflowInstanceId,
|
||||
WorkflowState = workflowState,
|
||||
DefinitionId = workflowState.DefinitionId,
|
||||
|
||||
@@ -19,6 +19,8 @@ public class CreateWorkflowInstanceRequest
|
||||
/// </summary>
|
||||
public string? CorrelationId { get; set; }
|
||||
|
||||
public long? ExternalUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the workflow instance to be created.
|
||||
/// </summary>
|
||||
|
||||
@@ -26,4 +26,6 @@ public class DispatchTriggerWorkflowsRequest(string activityTypeName, object boo
|
||||
/// Any properties to attach to the workflow instance.
|
||||
/// </summary>
|
||||
public IDictionary<string, object>? Properties { get; set; }
|
||||
|
||||
public long? ExternalUserId { get; set; }
|
||||
}
|
||||
@@ -35,6 +35,7 @@ public class LocalWorkflowClient(
|
||||
var options = new WorkflowInstanceOptions
|
||||
{
|
||||
WorkflowInstanceId = WorkflowInstanceId,
|
||||
ExternalUserId = request.ExternalUserId,
|
||||
CorrelationId = request.CorrelationId,
|
||||
Name = request.Name,
|
||||
ParentWorkflowInstanceId = request.ParentId,
|
||||
@@ -153,6 +154,7 @@ public class LocalWorkflowClient(
|
||||
var options = new WorkflowInstanceOptions
|
||||
{
|
||||
WorkflowInstanceId = WorkflowInstanceId,
|
||||
ExternalUserId = request.ExternalUserId,
|
||||
CorrelationId = request.CorrelationId,
|
||||
Name = request.Name,
|
||||
ParentWorkflowInstanceId = request.ParentId,
|
||||
|
||||
Reference in New Issue
Block a user