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.