Browse Source

Merge pull request #430 from colinin/4.4.3

solve string serialization problem
pull/431/head 4.4.3
yx lin 4 years ago
committed by GitHub
parent
commit
b15e0e586e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.LifeCycleEvent/LINGYUN/Abp/WorkflowCore/LifeCycleEvent/AbpEventBusProvider.cs
  2. 8
      aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Persistence.EntityFrameworkCore/LINGYUN/Abp/WorkflowCore/Persistence/EntityFrameworkCore/EfCoreWorkflowRepository.cs
  3. 2
      aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Persistence/LINGYUN/Abp/WorkflowCore/Persistence/Workflow.cs
  4. 2
      aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Persistence/LINGYUN/Abp/WorkflowCore/Persistence/WorkflowExtensions.cs
  5. 21
      aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore.Persistence/WorkflowCore/Models/WorkflowExtensions.cs
  6. 2
      aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore/LINGYUN/Abp/WorkflowCore/WorkflowBase.cs
  7. 8
      aspnet-core/modules/workflow/LINGYUN.Abp.WorkflowCore/System/ObjectSerializerExtensions.cs

2
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);
}

8
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<IQueryable<Workflow>> WithDetailsAsync()
{
var quertable = await base.WithDetailsAsync();
return quertable
.Include(x => x.ExecutionPointers)
.ThenInclude(p => p.ExtensionAttributes);
}
}
}

2
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)
{

2
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,

21
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,

2
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; }

8
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);
}
}
}

Loading…
Cancel
Save