类型或命名空间名称“SqlWorkflowInstanceStore”

发布于 2024-10-18 21:10:29 字数 1357 浏览 2 评论 0原文

我正在使用 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();
        }
    }
}

I'm building some basic workflow functionality in WF 4.0 with SqlWorkflowInstanceStore.
I have added the right references and have tried switching from client profile but still the same problem:

I get the following error in the error list in Visual Studio 2010:

Error 1 The type or namespace name 'SqlWorkflowInstanceStore' could not be found (are you missing a using directive or an assembly reference?)

I'm stuck and have no idea how to fix this.

Here's the code:

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

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

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

发布评论

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

评论(2

甜嗑 2024-10-25 21:10:29

最后!我成功了。

删除引用并将其添加回来后,错误消失了。
我只希望我以前尝试过这个。

:)

Finally! I got it working.

After removing the references and adding them back in the error disappeared.
I only wish I had tried this before.

:)

空心↖ 2024-10-25 21:10:29

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

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

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

我知道是对的:D

希望它可以帮助人们

I've encountered the same error in .Net 4 when working with Workflow persistence, so thought I'll share my findings

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

The namespace that we are trying to use is System.Activities.DurableInstancing, BUT the assembly that we need to reference is actually System.Runtime.DurableInstancing

I know right:D

Hope it helps people

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