我在vb.net中创建了一个非常简单的状态机类库项目。 这只有3个状态 - CreateApplication,ProcessApplication和CompleteApplication。 我在同一个项目中创建了一个接口。我通过调用ApplicationService.CreateApplication(ApplicationDetail的obj)从Web应用程序调用它。
<ExternalDataExchange()> _
Public Interface IApplicationService
Event ApplicationCreated As EventHandler(Of ApplicationDetailEventArgs)
Event ApplicationProcessed As EventHandler(Of ApplicationDetailEventArgs)
End Interface
我在ApplicationService.vb
中也有它的实现 Public Class ApplicationService
Implements IApplicationService
Public Event ApplicationCreated(ByVal sender As Object, ByVal e As ApplicationDetailEventArgs) Implements IApplicationService.ApplicationCreated
Public Event ApplicationProcessed(ByVal sender As Object, ByVal e As ApplicationDetailEventArgs) Implements IApplicationService.ApplicationProcessed
Public Shared Sub CreateApplication(ByVal objApplicationDetail As ApplicationDetail)
Using workflowRuntime As New WorkflowRuntime()
AddHandler workflowRuntime.WorkflowCompleted, AddressOf OnWorkflowCompleted
AddHandler workflowRuntime.WorkflowTerminated, AddressOf OnWorkflowTerminated
Dim workflowInstance As WorkflowInstance
workflowInstance = workflowRuntime.CreateWorkflow(GetType(Workflow1))
workflowInstance.Start()
End Using
'Code to create application
End Sub
Shared Sub OnWorkflowCompleted(ByVal sender As Object, ByVal e As WorkflowCompletedEventArgs)
End Sub
Shared Sub OnWorkflowTerminated(ByVal sender As Object, ByVal e As WorkflowTerminatedEventArgs)
End Sub
End Class
我的问题是,当我尝试运行它时,我获得了workflowInstance的价值。 InstanceId为空。
自从过去两天以来,我一直试图解决这个问题。 有人可以帮忙。
提前致谢!
答案 0 :(得分:0)
嗯......我能够弄清楚问题是什么。 它与工作流程无关。这是Visual Studio(2005和2008)中的一个错误。当您在VB.Net中调试时,Guid的值显示为空,但如果您使用Guid.ToString ..它工作正常。这在C#中可以正常工作。