How to hook up WF4 WorkflowRuntime events when using a XAMLX service
Posted
by Joel D'Souza
on Stack Overflow
See other posts from Stack Overflow
or by Joel D'Souza
Published on 2010-05-27T02:51:56Z
Indexed on
2010/05/27
3:01 UTC
Read the original article
Hit count: 807
I'm currently using a BehaviorExtensionElement to load a ServiceBehavior where the ApplyDispatchBehavior method is set up as:
public void ApplyDispatchBehavior(ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase)
{
WorkflowServiceHost host = serviceHostBase as WorkflowServiceHost;
if (host != null)
{
UnityService.CreateContainer();
host.WorkflowExtensions.Add<IUnityContainer>(delegate { return UnityService.CreateChildContainer(); });
System.Diagnostics.Debug.WriteLine("NotificationService : Adding extension");
WorkflowRuntimeBehavior wfbehavior = serviceDescription.Behaviors.Find<WorkflowRuntimeBehavior>();
WorkflowRuntime runtime = wfbehavior.WorkflowRuntime;
runtime.WorkflowStarted += runtime_WorkflowStarted;
runtime.WorkflowCreated += runtime_WorkflowCreated;
runtime.WorkflowUnloaded += runtime_WorkflowUnloaded;
runtime.WorkflowSuspended += runtime_WorkflowSuspended;
runtime.WorkflowCompleted += runtime_WorkflowCompleted;
runtime.WorkflowAborted += runtime_WorkflowAborted;
runtime.WorkflowTerminated += runtime_WorkflowTerminated;
}
}
None of the events are triggered which only goes to say that the way I'm referencing the runtime instance in this particular scenario is wrong.
Anyone know of a way to do this? Thanks in advance.
© Stack Overflow or respective owner