diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.LifeCycleEvent/LINGYUN/Abp/WorkflowCore/LifeCycleEvent/AbpEventBusProvider.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.LifeCycleEvent/LINGYUN/Abp/WorkflowCore/LifeCycleEvent/AbpEventBusProvider.cs index 400bb9fa0..0729a3f10 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.LifeCycleEvent/LINGYUN/Abp/WorkflowCore/LifeCycleEvent/AbpEventBusProvider.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.LifeCycleEvent/LINGYUN/Abp/WorkflowCore/LifeCycleEvent/AbpEventBusProvider.cs @@ -34,7 +34,7 @@ namespace LINGYUN.Abp.WorkflowCore.LifeCycleEvent public async Task PublishNotification(EventData evt) { - var data = evt.SerializeObject(_serializerSettings); + var data = evt.SerializeObject(serializerSettings: _serializerSettings); var wrapEvent = new LifeCycleEventWrap(data); await _eventBus.PublishAsync(wrapEvent); } diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Persistence.EntityFrameworkCore/LINGYUN/Abp/WorkflowCore/Persistence/EntityFrameworkCore/EfCoreWorkflowRepository.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Persistence.EntityFrameworkCore/LINGYUN/Abp/WorkflowCore/Persistence/EntityFrameworkCore/EfCoreWorkflowRepository.cs index 9385fdbdb..9085f8189 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Persistence.EntityFrameworkCore/LINGYUN/Abp/WorkflowCore/Persistence/EntityFrameworkCore/EfCoreWorkflowRepository.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Persistence.EntityFrameworkCore/LINGYUN/Abp/WorkflowCore/Persistence/EntityFrameworkCore/EfCoreWorkflowRepository.cs @@ -36,5 +36,13 @@ namespace LINGYUN.Abp.WorkflowCore.Persistence .PageBy(skip, take) .ToListAsync(); } + + public override async Task> WithDetailsAsync() + { + var quertable = await base.WithDetailsAsync(); + return quertable + .Include(x => x.ExecutionPointers) + .ThenInclude(p => p.ExtensionAttributes); + } } } diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Persistence/LINGYUN/Abp/WorkflowCore/Persistence/Workflow.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Persistence/LINGYUN/Abp/WorkflowCore/Persistence/Workflow.cs index 711328af9..278d5d738 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Persistence/LINGYUN/Abp/WorkflowCore/Persistence/Workflow.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Persistence/LINGYUN/Abp/WorkflowCore/Persistence/Workflow.cs @@ -35,8 +35,8 @@ namespace LINGYUN.Abp.WorkflowCore.Persistence int version, string description, string reference, + WorkflowStatus status, long? nextExecution = null, - WorkflowStatus status = WorkflowStatus.Terminated, DateTime? completeTime = null, Guid? tenantId = null) : base(id) { diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Persistence/LINGYUN/Abp/WorkflowCore/Persistence/WorkflowExtensions.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Persistence/LINGYUN/Abp/WorkflowCore/Persistence/WorkflowExtensions.cs index 389016411..51f9531a1 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Persistence/LINGYUN/Abp/WorkflowCore/Persistence/WorkflowExtensions.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Persistence/LINGYUN/Abp/WorkflowCore/Persistence/WorkflowExtensions.cs @@ -46,7 +46,7 @@ namespace LINGYUN.Abp.WorkflowCore.Persistence WorkflowDefinitionId = workflow.WorkflowDefinitionId, CompleteTime = workflow.CompleteTime.ToNullableUtcDateTime(), CreateTime = workflow.CreationTime.ToUtcDateTime(), - Data = workflow.Data.SerializeObject(), + Data = workflow.Data.DeserializeObject(), Status = workflow.Status, Description = workflow.Description, NextExecution = workflow.NextExecution, diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Persistence/WorkflowCore/Models/WorkflowExtensions.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Persistence/WorkflowCore/Models/WorkflowExtensions.cs index e5359fbd7..bb629884c 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Persistence/WorkflowCore/Models/WorkflowExtensions.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Persistence/WorkflowCore/Models/WorkflowExtensions.cs @@ -17,18 +17,19 @@ namespace WorkflowCore.Models generator.Create(), instance.CreateTime, instance.WorkflowDefinitionId, - instance.Data.SerializeObject(), + instance.Data.SerializeObject(handlingString: true), instance.Version, instance.Description, instance.Reference, - instance.NextExecution, instance.Status, + instance.NextExecution, instance.CompleteTime, currentTenant.Id); foreach (var pointer in instance.ExecutionPointers) { - pointer.ToWorkflowExecutionPointer(workflow, generator, currentTenant); + var toPointer = pointer.ToWorkflowExecutionPointer(workflow, generator, currentTenant); + workflow.AddPointer(toPointer); } return workflow; @@ -46,16 +47,16 @@ namespace WorkflowCore.Models executionPointer.StepId, executionPointer.StepName, executionPointer.Active, - executionPointer.PersistenceData.SerializeObject(), + executionPointer.PersistenceData.SerializeObject(handlingString: true), executionPointer.EventName, executionPointer.EventKey, executionPointer.EventPublished, - executionPointer.EventData.SerializeObject(), + executionPointer.EventData.SerializeObject(handlingString: true), executionPointer.RetryCount, executionPointer.Children.JoinAsString(";"), - executionPointer.ContextItem.SerializeObject(), + executionPointer.ContextItem.SerializeObject(handlingString: true), executionPointer.PredecessorId, - executionPointer.Outcome.SerializeObject(), + executionPointer.Outcome.SerializeObject(handlingString: true), executionPointer.Scope.JoinAsString(";"), executionPointer.Status, executionPointer.SleepUntil, @@ -65,7 +66,7 @@ namespace WorkflowCore.Models foreach (var attribute in executionPointer.ExtensionAttributes) { - pointer.AddAttribute(attribute.Key, attribute.Value.SerializeObject()); + pointer.AddAttribute(attribute.Key, attribute.Value.SerializeObject(handlingString: true)); } executionPointer.Id = pointer.Id.ToString(); @@ -82,7 +83,7 @@ namespace WorkflowCore.Models generator.Create(), @event.EventName, @event.EventKey, - @event.EventData.SerializeObject(), + @event.EventData.SerializeObject(handlingString: true), @event.EventTime, currentTenant.Id) { @@ -105,7 +106,7 @@ namespace WorkflowCore.Models subscription.EventName, subscription.EventKey, subscription.SubscribeAsOf, - subscription.SubscriptionData.SerializeObject(), + subscription.SubscriptionData.SerializeObject(handlingString: true), subscription.ExternalToken, subscription.ExternalWorkerId, subscription.ExternalTokenExpiry, diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore/LINGYUN/Abp/WorkflowCore/WorkflowBase.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore/LINGYUN/Abp/WorkflowCore/WorkflowBase.cs index 46bcbec89..836245a4e 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore/LINGYUN/Abp/WorkflowCore/WorkflowBase.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore/LINGYUN/Abp/WorkflowCore/WorkflowBase.cs @@ -3,7 +3,7 @@ using WorkflowCore.Interface; namespace LINGYUN.Abp.WorkflowCore { - public abstract class WorkflowBase : IWorkflow, ISingletonDependency + public abstract class WorkflowBase : IWorkflow, ITransientDependency { public abstract string Id { get; } diff --git a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore/System/ObjectSerializerExtensions.cs b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore/System/ObjectSerializerExtensions.cs index f157609ac..ef91e3f51 100644 --- a/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore/System/ObjectSerializerExtensions.cs +++ b/aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore/System/ObjectSerializerExtensions.cs @@ -4,11 +4,11 @@ namespace System { public static class ObjectSerializerExtensions { - private static JsonSerializerSettings SerializerSettings = new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.All }; + private readonly static JsonSerializerSettings SerializerSettings = new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.All }; - public static string SerializeObject(this object obj, JsonSerializerSettings serializerSettings = null) + public static string SerializeObject(this object obj, bool handlingString = false, JsonSerializerSettings serializerSettings = null) { - if (obj is string objStr) + if (obj is string objStr && !handlingString) { return objStr; } @@ -17,7 +17,7 @@ namespace System public static object DeserializeObject(this string str, JsonSerializerSettings serializerSettings = null) { - return JsonConvert.DeserializeObject(str, serializerSettings ?? SerializerSettings); + return JsonConvert.DeserializeObject(str ?? string.Empty, serializerSettings ?? SerializerSettings); } } }