protected override void Execute(NativeActivityContext context) { Boolean waitComplete = WaitComplete.Get <Boolean>(context); IDbContext dbContext = context.GetExtension <IDbContext>(); var messaging = context.GetExtension <IMessaging>(); IApplicationHost host = context.GetExtension <IApplicationHost>(); context.DoTrack(dbContext, TrackBefore.Get <TrackRecord>(context)); context.DoModelState(dbContext, StateBefore.Get <ModelStateInfo>(context)); var pi = ProcessInfo.Get <StartProcessInfo>(context); String bookmark = null; var process = Process.GetProcessFromContext(context); if (waitComplete) { bookmark = Guid.NewGuid().ToString(); var wfResult = context.GetExtension <WorkflowResult>(); // TODO: WAIT COMPLETE FOR CHILDREN //Int64 pid = process.CreateChildren(dbContext, kind, docId, bookmark, Mark.Get<String>(context)); } var sfi = new StartWorkflowInfo() { UserId = process.Owner, Source = pi.Workflow, DataSource = pi.DataSource, Schema = pi.Schema, Model = pi.ModelName, ModelId = pi.ModelId, ActionBase = pi.ActionBase, Parent = process.Id }; var task = AppWorkflow.StartWorkflow(host, dbContext, messaging, sfi); task.Wait(); WorkflowResult result = task.Result; if (waitComplete) { context.CreateBookmark(bookmark, new BookmarkCallback(this.ContinueAt)); } else { Result.Set(context, String.Empty); } }
protected override void Execute(NativeActivityContext context) { var process = Process.GetProcessFromContext(context.DataContext); var wfResult = context.GetExtension <WorkflowResult>(); Inbox inbox = Inbox.Get <Inbox>(context); IDbContext dbContext = context.GetExtension <IDbContext>(); inbox.Create(dbContext, process.Id); InboxId.Set(context, inbox.Id); wfResult.InboxIds.Add(inbox.Id); // track before DoTrack(dbContext, TrackBefore.Get <TrackRecord>(context), context); // send before SendMessage(SendBefore.Get <MessageInfo>(context), inbox, context); TrackRecord(context, $"Inbox created {{Id: {inbox.Id}}}."); context.CreateBookmark(inbox.Bookmark, new BookmarkCallback(this.ContinueAt)); }