public async Task <Workflow> DeserializeAsync(JToken token, CancellationToken cancellationToken) { var workflow = await workflowTokenizer.DetokenizeWorkflowAsync(token, cancellationToken); var descriptors = await activityLibrary.ListAsync(cancellationToken).ToDictionaryAsync(x => x.Name); foreach (var activity in workflow.Activities) { activity.Descriptor = descriptors[activity.Name]; } return(workflow); }
public static Task <IEnumerable <ActivityDescriptor> > ListBrowsableAsync(this IActivityLibrary activityLibrary, CancellationToken cancellationToken) { return(activityLibrary.ListAsync(x => x.IsBrowsable, cancellationToken)); }
public static Task <ActivityDescriptor> GetByNameAsync(this IActivityLibrary activityLibrary, string name, CancellationToken cancellationToken) { return(activityLibrary .ListAsync(x => x.Name == name, cancellationToken) .SingleOrDefaultAsync()); }
public static async Task <IEnumerable <ActivityDescriptor> > ListAsync(this IActivityLibrary activityLibrary, Func <ActivityDescriptor, bool> predicate, CancellationToken cancellationToken) { var descriptors = await activityLibrary.ListAsync(cancellationToken).ToListAsync(); return(descriptors.Where(predicate)); }