类型或命名空间名称“SqlWorkflowInstanceStore”
我正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最后!我成功了。
删除引用并将其添加回来后,错误消失了。
我只希望我以前尝试过这个。
:)
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.
:)
在使用工作流持久性时,我在 .Net 4 中遇到了相同的错误,所以我想分享我的发现
我们尝试使用的命名空间是 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 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