2

我正在使用SqlWorkflowInstanceStore在WF 4.0中構建一些基本工作流功能。 我已經加入了正確的引用,並試圖從客戶端配置文件切換,但仍是同樣的問題:類型或名稱空間名稱'SqlWorkflowInstanceStore'

我得到的錯誤列表下面的錯誤在Visual Studio 2010中:

錯誤1類型或命名空間名稱SqlWorkflowInstanceStore'找不到(您是否缺少使用指令或程序集引用?)

我被卡住了,不知道如何解決此問題。

下面的代碼:

using System; 
using System.Linq; 
using System.Activities; 
using System.Activities.Statements; 
using System.Activities.DurableInstancing; 
using System.Runtime.DurableInstancing; 
using System.Threading; 

namespace mybasicwf4 
{ 

    class Program 
    { 
     static void Main(string[] args) 
     { 
      string sqlPersistenceDBConnectionString = @"Data Source=.;Initial Catalog=PersistenceDatabase;Integrated Security=True"; 
      SqlWorkflowInstanceStore sqlWFInstanceStore = new SqlWorkflowInstanceStore(sqlPersistenceDBConnectionString); 
      AutoResetEvent waitHandler = new AutoResetEvent(false); 
      WorkflowApplication wfApp = new WorkflowApplication(new Workflow1()); 
      wfApp.InstanceStore = sqlWFInstanceStore; 
      wfApp.Unloaded = (arg) => 
      { 
       waitHandler.Set(); 
      }; 
      wfApp.PersistableIdle = (arg) => 
      { 
       return PersistableIdleAction.Unload; 
      }; 
      wfApp.Run(); 
      waitHandler.WaitOne(); 
     } 
    } 
} 

回答

0

終於來了!我得到了它的工作。

刪除引用並將它們添加回錯誤消失後。 我只希望我曾嘗試過。

:)

0

與工作流的持久性工作時,我遇到了同樣的錯誤在.NET 4中,所以以爲我會分享我的發現

The type 'System.Runtime.DurableInstancing.InstanceStore' is defined in an assembly that is not referenced. 

,我們試圖使用的命名空間是System.Activities.DurableInstancing,但我們需要引用的程序集實際上是System。 運行 .DurableInstancing

我知道對不對:d

希望它可以幫助人們

相關問題