卸载还是不卸载.就是那个问题 [英] To unload or not to unload. That is the question

查看:107
本文介绍了卸载还是不卸载.就是那个问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用示例创建了一个XML持久性参与者和实例存储.我的问题是,仅使用延迟活动时,工作流会触发OnIdle并因此将其卸载.基于此线程的答案:
http://social.msdn.microsoft.com/Forums/zh-CN/wfprerelease/thread/b31e58eb-ff74-423e-b48d-005ec081b8e0

它应该设置为否保持区域,为什么它会处于空闲状态?

I have created a XML persistence participant and instance store using the samples.  The problem I have is that when using just a delay activity the workflow triggers OnIdle and thusly unloads. Based on the answer in this thread:
http://social.msdn.microsoft.com/Forums/en-US/wfprerelease/thread/b31e58eb-ff74-423e-b48d-005ec081b8e0

It should be setting up a no persist zone so why is it going Idle? Am I missing something when it comes to determining when to unload?

推荐答案

您好,在那里.
没有直接的关联.在空闲和持久之间进行操作.
如果已将其设置为持久并且已实现PersistableIdle函数以返回PersistableIdleAction.Unload,则它将卸载.但是您不必卸载它.

例如:

AutoResetEvent sync = new AutoResetEvent(false);
WorkflowApplication实例= new WorkflowApplication(new Workflow1( ));
instance.OnUnhandledException = OnError;
instance.Idle =(WorkflowApplicationIdleEventArgs e)=>
{
Console.WriteLine("Idled");
};
instance.PersistableIdle =(WorkflowApplicationIdleEventArgs e)=>
.WriteLine("Idle");
返回PersistableIdleAction.None;
};
instance.Completed =(WorkflowApplicationCompletedEventArgs e)=>
WriteLine(工作流程已完成");
sync.Set();
};

Hi there.
There is not a direct correlation between going idle and persisting.
If you have it set up to persist and you have implemented the PersistableIdle function to return PersistableIdleAction.Unload then it will unload.  But you don't have to unload it.

ex:

AutoResetEvent sync = new AutoResetEvent(false);
WorkflowApplication instance = new WorkflowApplication(new Workflow1());
instance.OnUnhandledException = OnError;
instance.Idle = (WorkflowApplicationIdleEventArgs e) =>
    {
        Console.WriteLine("Idled");
    };
instance.PersistableIdle = (WorkflowApplicationIdleEventArgs e) =>
    {
        Console.WriteLine("Idle");
        return PersistableIdleAction.None;
    };
instance.Completed = (WorkflowApplicationCompletedEventArgs e) =>
    {
        Console.WriteLine("Workflow Completed");
        sync.Set();
    };

instance.Run();
sync.WaitOne();
Console.WriteLine("Bye");


这将使它闲置,但不能卸载.
希望有帮助.
Scott

instance.Run();
sync.WaitOne();
Console.WriteLine("Bye");


This will idle it, but not unload it.
Hope that helps.
Scott


这篇关于卸载还是不卸载.就是那个问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆