private async Task <object> DeserializeAsync(object value) { var context = new SerializeWorkflowValueContext(value); await _workflowValueSerializers.Resolve().InvokeAsync(x => x.DeserializeValueAsync(context), _logger); return(context.Output); }
public async Task DeserializeValueAsync(SerializeWorkflowValueContext context) { if (context.Input is JObject jObject) { var type = jObject.Value <string>("Type"); if (type == "Content") { var contentId = jObject.Value <string>("ContentId"); context.Output = contentId != null ? await _contentManager.GetAsync(contentId, VersionOptions.Latest) : default(IContent); } } }
public Task SerializeValueAsync(SerializeWorkflowValueContext context) { if (context.Input is IContent content) { context.Output = JObject.FromObject(new { Type = "Content", ContentId = content.ContentItem.ContentItemId }); } return(Task.CompletedTask); }
public Task RehydrateValueAsync(SerializeWorkflowValueContext context) { return(Task.CompletedTask); }