在使用重新托管的活动中使用和调用 bookamrk
我正在使用 WF,我重新托管了设计器,一切都很好,直到我需要在自定义活动中等待工作流程运行时的值,这就是我使用 BOOKMARK 制作的值。我尝试在 ConsoleApplication 中添加书签及其工作。 我在 ConsoleApplication 的主类中使用了以下代码:
AutoResetEvent syncEvent = new AutoResetEvent(false);
wa.Completed = delegate(WorkflowApplicationCompletedEventArgs r)
{
syncEvent.Set();
};
wa.Run();
wa.ResumeBookmark("bookmarkName", Console.ReadLine());
syncEvent.WaitOne();
但在我的重新托管项目中,我需要调用许多工作流程。不仅是1.而且我无法在运行前指定它。 对于此方法:
wa.ResumeBookmark("bookmarkName", Console.ReadLine());
第一个参数:书签的名称,我尝试过,发现我可以将所有书签命名为相同的名称。 关于第二个参数,如何传递每个工作流程的值,并且某些工作流程有超过 1 个书签。 我必须从很多地方读取值,asp.net 页面、DB 和其他地方。 我确信WF 4.0中有类似的东西,但我没有找到它。你能帮我吗:) 谢谢。
I'm using WF, I res-hosted the designer, and everything is fine till i need in my custom activities to wait a value when workflow is running, that what i made using BOOKMARK. i tried bookmark in ConsoleApplication and its work.
the following code i used in the main class in the ConsoleApplication:
AutoResetEvent syncEvent = new AutoResetEvent(false);
wa.Completed = delegate(WorkflowApplicationCompletedEventArgs r)
{
syncEvent.Set();
};
wa.Run();
wa.ResumeBookmark("bookmarkName", Console.ReadLine());
syncEvent.WaitOne();
but here in my rehosted project, i need to call many workflows. not only 1. and I can't specify it before runtime.
for this method:
wa.ResumeBookmark("bookmarkName", Console.ReadLine());
1st argument: bookmarks' names, i tried and i found i can name all bookmarks the same name.
About the 2nd argument, how can I pass the value for each workflow, and some workflows have more than 1 bookmark.
I have to read the value from many places, asp.net pages, DB and others.
Im sure there is something like these in WF 4.0, but i didnt find it. can u help me please :)
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要跟踪每个工作流的 Id ,并在创建书签时记录该 Id。一旦您希望返回工作流程,您可以搜索具有匹配 ID 的工作流程,然后恢复您的书签。
You need to keep track of each workflow's Id, and record that Id when a bookmark is created. Once you wish to return to the workflow, you can search for the one with the matching Id and then resume your bookmark.