【问题标题】:The type or namespace name 'SqlWorkflowInstanceStore'类型或命名空间名称“SqlWorkflowInstanceStore”
【发布时间】:2011-02-22 22:34:33
【问题描述】:

我正在使用 SqlWorkflowInstanceStore 在 WF 4.0 中构建一些基本的工作流功能。 我添加了正确的引用并尝试从客户端配置文件切换,但仍然是同样的问题:

我在 Visual Studio 2010 的错误列表中收到以下错误:

错误 1 ​​找不到类型或命名空间名称“SqlWorkflowInstanceStore”(您是否缺少 using 指令或程序集引用?)

我被卡住了,不知道如何解决这个问题。

代码如下:

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();
        }
    }
}

【问题讨论】:

    标签: .net visual-studio-2010 .net-4.0 workflow workflow-foundation-4


    【解决方案1】:

    终于!我搞定了。

    删除引用并重新添加它们后,错误消失了。 我只希望我以前尝试过这个。

    :)

    【讨论】:

      【解决方案2】:

      在使用工作流持久性时,我在 .Net 4 中遇到了同样的错误,所以想我会分享我的发现

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

      我们尝试使用的命名空间是 System.Activities.DurableInstancing,但我们需要引用的程序集实际上是 System.Runtime.DurableInstancing

      我知道是对的:D

      希望对大家有所帮助

      【讨论】:

        猜你喜欢
        • 2013-03-25
        • 2016-01-31
        • 1970-01-01
        • 1970-01-01
        • 2012-06-19
        • 1970-01-01
        • 2012-05-28
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多