ASP.NET 工作流调用外部方法

发布于 2024-07-16 23:09:56 字数 543 浏览 2 评论 0原文

我不确定我是否缺少明显的东西,而Windows Workflow在ASP.NET中使用了Windows WorkFlow,我真的不知道如何将工作流从ASP.NET工作流中获取输出。

我的工作流设置可以处理外部事件,因此我的网页可以调用它,哪个可以正常工作,但是如何再次获取信息? 我是否必须查询工作流对象才能找到所需的信息? 这似乎是错误的...

我认为我能做的就是使用工作流程中的callexternalMethod,但是由于运行时只能有一个工作流外部数据服务的实例,我不确定如何附加' '对单个页面?

我发现的所有示例似乎都使用页面工作流示例,其中工作流的输出(当它调用 CallExternalMethod 时)仅调用静态重定向方法。 例如,如果我不想重定向,而是将工作流程的结果打印到页面,我如何“捕获”该信息以便可以在页面中使用它? (假设运行时是从示例中的包装器中调用的,所以不能只做label1.text = bla,因为无法访问该变量)。

编辑:或者是使用工作流程持续到数据库的任何内容并将ASP.NET应用程序查询给定数据的问题(因为实例GUID可以用作PK?)

I'm not sure if I'm missing something obvious, with Windows Workflow used from within ASP.NET I don't really know how to get output from the Workflow back to the ASP.NET workflow.

I have my workflow setup to handle external event, so my web page can invoke it, which works fine, but how do I get the information out again? Do I have to query the Workflow object to find the information I want? This just seems wrong...

What I thought I could do was use the CallExternalMethod in the workflow, but since there can only be one instance of the Workflow External Data service in the runtime, I'm not sure how it can be 'attached' to the individual pages?

All examples I have found seem to use the Page Workflow example in which the output from the workflow (when it calls CallExternalMethod) just calls the static redirect method. If for example I didn't want to redirect, but print the result from the workflow to the page, how do i 'capture' that information so it can be used in the page? (assuming that the runtime is called from a wrapper like the examples, so cant just do Label1.Text = bla since there is no access to that variable).

Edit: Or is it a matter of using the workflow to persist anything to the database and have the ASP.NET app query the given data from there (since instance GUID can be used as PK?)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

为你拒绝所有暧昧 2024-07-23 23:09:56

此链接包含有关将信息传入和传出工作流程的信息:

http://books.google.com/books?id=s5eVXpNmQxgC&pg=PA32&dq=pro+windows+workflow+foundation#PPA241,M1

网页:
网页和上面链接中的 WinForm 示例的唯一区别是您需要使用 MaualWorkflowSchedulerService (这会捐赠网页使用的线程,而不是为工作流运行时创建一个新线程)。

因此,假设您正在通过单击按钮来调用ExternalMethod(DataEvents是您添加到处理/调用外部方法的运行时的服务):

    AddHandler DataEvents.DataReceived, AddressOf workflowEventsDataReceived    
    manualScheduler = WorkflowrunTime.GetService(GetType(Hosting.ManualWorkflowSchedulerService))
    DataEvents.OnGetDataReceived(New ExternalDataEventArgs(WorkflowInstance.InstanceId))
    manualScheduler.RunWorkflow(WorkflowInstance.InstanceId)

然后是workflowEventsDataReceived处的方法,它是工作流内的 CallExternalMethod(通过您添加到 WorkflowrunTime 的服务)将能够更新您想要的所有标签。

不确定这些是否清楚,但如果需要更多帮助,请告诉我,上周末我自己也遇到了同样的问题。

This link has information about passing information in and out of workflows:

http://books.google.com/books?id=s5eVXpNmQxgC&pg=PA32&dq=pro+windows+workflow+foundation#PPA241,M1

In respect to a web page:
The only difference to a webpage and the WinForm example in the link above is that you need to use the MaualWorkflowSchedulerService (this donates the thread the webpage used instead of making a new one for the workflow runtime).

So, say you are invoking the ExternalMethod in a button click with somthing like this (DataEvents being the service you add to the run time for your Handle / Call external methods):

    AddHandler DataEvents.DataReceived, AddressOf workflowEventsDataReceived    
    manualScheduler = WorkflowrunTime.GetService(GetType(Hosting.ManualWorkflowSchedulerService))
    DataEvents.OnGetDataReceived(New ExternalDataEventArgs(WorkflowInstance.InstanceId))
    manualScheduler.RunWorkflow(WorkflowInstance.InstanceId)

Then the method at workflowEventsDataReceived, which is the target of a CallExternalMethod inside the workflow (via the service you added to the WorkflowrunTime) will be able to update all the labels you want.

Not sure if any of that is clear, but let me know if need more help, was going through the same problem myself last weekend.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文