2010-01-20 113 views
0

我在vb.net中創建了一個非常簡單的狀態機類庫項目。 這隻有3個狀態 - CreateApplication,ProcessApplication和CompleteApplication。 我已經在相同project.I創建的接口正在從Web應用程序調用它通過調用ApplicationService.CreateApplication(OBJ ApplicationDetail的)狀態機工作流 - VB.NET

<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

呃..我能夠找出問題所在。 它與工作流無關。這是Visual Studio(2005和2008)中的一個錯誤。當你在VB.Net中調試時,Guid的值顯示爲空,但是如果你使用Guid.ToString..it工作正常。這在C#中可以正常工作。