Remove redundant activity metadata properties from ActivityExecutionRecordSnapshot and streamline mapping logic
Deleted unused metadata properties to simplify `ActivityExecutionRecordSnapshot`. Updated `GetOrMapCapturedActivityExecutionRecordAsync` to maintain serialized snapshots when mapping, ensuring consistency in activity execution records.
This commit is contained in:
parent
18ee694d23
commit
61179bcb53
|
|
@ -18,10 +18,12 @@ public static class ActivityExecutionContextRecordExtensions
|
|||
|
||||
public static async Task<ActivityExecutionRecord> GetOrMapCapturedActivityExecutionRecordAsync(this ActivityExecutionContext context)
|
||||
{
|
||||
if(context.TransientProperties.TryGetValue(ActivityExecutionRecordKey, out var record))
|
||||
return (ActivityExecutionRecord)record;
|
||||
|
||||
var mapper = context.GetRequiredService<IActivityExecutionMapper>();
|
||||
return await mapper.MapAsync(context);
|
||||
var record = await mapper.MapAsync(context);
|
||||
|
||||
if (context.TransientProperties.TryGetValue(ActivityExecutionRecordKey, out var capturedRecord))
|
||||
record.SerializedSnapshot = ((ActivityExecutionRecord)capturedRecord).SerializedSnapshot;
|
||||
|
||||
return record;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,19 +2,6 @@ namespace Elsa.Workflows.Runtime;
|
|||
|
||||
public class ActivityExecutionRecordSnapshot
|
||||
{
|
||||
public string Id { get; set; } = null!;
|
||||
public string? TenantId { get; set; }
|
||||
public string WorkflowInstanceId { get; set; } = null!;
|
||||
public string ActivityId { get; set; } = null!;
|
||||
public string ActivityNodeId { get; set; } = null!;
|
||||
public string ActivityType { get; set; } = null!;
|
||||
public int ActivityTypeVersion { get; set; }
|
||||
public string? ActivityName { get; set; }
|
||||
public DateTimeOffset StartedAt { get; set; }
|
||||
public bool HasBookmarks { get; set; }
|
||||
public ActivityStatus Status { get; set; }
|
||||
public int AggregateFaultCount { get; set; }
|
||||
public DateTimeOffset? CompletedAt { get; set; }
|
||||
public string? SerializedActivityState { get; set; }
|
||||
public string? SerializedOutputs { get; set; }
|
||||
public string? SerializedProperties { get; set; }
|
||||
|
|
|
|||
|
|
@ -58,19 +58,6 @@ public class DefaultActivityExecutionMapper(
|
|||
var serializedMetadata = record.Metadata != null ? payloadSerializer.Serialize(record.Metadata) : null;
|
||||
record.SerializedSnapshot = new()
|
||||
{
|
||||
Id = record.Id,
|
||||
TenantId = record.TenantId,
|
||||
WorkflowInstanceId = record.WorkflowInstanceId,
|
||||
ActivityId = record.ActivityId,
|
||||
ActivityNodeId = record.ActivityNodeId,
|
||||
ActivityType = record.ActivityType,
|
||||
ActivityTypeVersion = record.ActivityTypeVersion,
|
||||
ActivityName = record.ActivityName,
|
||||
StartedAt = record.StartedAt,
|
||||
HasBookmarks = record.HasBookmarks,
|
||||
Status = record.Status,
|
||||
AggregateFaultCount = record.AggregateFaultCount,
|
||||
CompletedAt = record.CompletedAt,
|
||||
SerializedActivityState = compressedSerializedActivityState,
|
||||
SerializedActivityStateCompressionAlgorithm = compressionAlgorithm,
|
||||
SerializedOutputs = record.Outputs?.Any() == true ? safeSerializer.Serialize(record.Outputs) : null,
|
||||
|
|
|
|||
Loading…
Reference in a new issue